Class: Azure::CognitiveServices::LuisAuthoring::V2_0::Pattern

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb

Overview

Pattern

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Pattern

Creates and initializes a new instance of the Pattern class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientLuisAuthoringClient (readonly)

Returns reference to the LuisAuthoringClient.

Returns:



22
23
24
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 22

def client
  @client
end

Instance Method Details

#add_pattern(app_id, version_id, pattern, custom_headers: nil) ⇒ PatternRuleInfo

Adds a pattern to a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern (PatternRuleCreateObject)

    The input pattern.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PatternRuleInfo)

    operation results.



35
36
37
38
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 35

def add_pattern(app_id, version_id, pattern, custom_headers:nil)
  response = add_pattern_async(app_id, version_id, pattern, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#add_pattern_async(app_id, version_id, pattern, custom_headers: nil) ⇒ Concurrent::Promise

Adds a pattern to a version of the application.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern (PatternRuleCreateObject)

    The input pattern.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 66

def add_pattern_async(app_id, version_id, pattern, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'pattern is nil' if pattern.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleCreateObject.mapper()
  request_content = @client.serialize(request_mapper,  pattern)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/patternrule'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#add_pattern_with_http_info(app_id, version_id, pattern, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Adds a pattern to a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern (PatternRuleCreateObject)

    The input pattern.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



51
52
53
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 51

def add_pattern_with_http_info(app_id, version_id, pattern, custom_headers:nil)
  add_pattern_async(app_id, version_id, pattern, custom_headers:custom_headers).value!
end

#batch_add_patterns(app_id, version_id, patterns, custom_headers: nil) ⇒ Array

Adds a batch of patterns in a version of the application.

patterns. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleCreateObject>)

    A JSON array containing

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



401
402
403
404
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 401

def batch_add_patterns(app_id, version_id, patterns, custom_headers:nil)
  response = batch_add_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#batch_add_patterns_async(app_id, version_id, patterns, custom_headers: nil) ⇒ Concurrent::Promise

Adds a batch of patterns in a version of the application.

patterns. to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleCreateObject>)

    A JSON array containing

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 434

def batch_add_patterns_async(app_id, version_id, patterns, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'patterns is nil' if patterns.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = {
    client_side_validation: true,
    required: true,
    serialized_name: 'patterns',
    type: {
      name: 'Sequence',
      element: {
          client_side_validation: true,
          required: false,
          serialized_name: 'PatternRuleCreateObjectElementType',
          type: {
            name: 'Composite',
            class_name: 'PatternRuleCreateObject'
          }
      }
    }
  }
  request_content = @client.serialize(request_mapper,  patterns)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/patternrules'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PatternRuleInfoElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PatternRuleInfo'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#batch_add_patterns_with_http_info(app_id, version_id, patterns, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Adds a batch of patterns in a version of the application.

patterns. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleCreateObject>)

    A JSON array containing

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



418
419
420
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 418

def batch_add_patterns_with_http_info(app_id, version_id, patterns, custom_headers:nil)
  batch_add_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
end

#delete_pattern(app_id, version_id, pattern_id, custom_headers: nil) ⇒ OperationStatus

Deletes the pattern with the specified ID from a version of the application..

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (OperationStatus)

    operation results.



766
767
768
769
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 766

def delete_pattern(app_id, version_id, pattern_id, custom_headers:nil)
  response = delete_pattern_async(app_id, version_id, pattern_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#delete_pattern_async(app_id, version_id, pattern_id, custom_headers: nil) ⇒ Concurrent::Promise

Deletes the pattern with the specified ID from a version of the application..

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 797

def delete_pattern_async(app_id, version_id, pattern_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'pattern_id is nil' if pattern_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/patternrules/{patternId}'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'patternId' => pattern_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#delete_pattern_with_http_info(app_id, version_id, pattern_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes the pattern with the specified ID from a version of the application..

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



782
783
784
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 782

def delete_pattern_with_http_info(app_id, version_id, pattern_id, custom_headers:nil)
  delete_pattern_async(app_id, version_id, pattern_id, custom_headers:custom_headers).value!
end

#delete_patterns(app_id, version_id, pattern_ids, custom_headers: nil) ⇒ OperationStatus

Deletes a list of patterns in a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_ids

    The patterns IDs.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (OperationStatus)

    operation results.



539
540
541
542
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 539

def delete_patterns(app_id, version_id, pattern_ids, custom_headers:nil)
  response = delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#delete_patterns_async(app_id, version_id, pattern_ids, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a list of patterns in a version of the application.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_ids

    The patterns IDs.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 570

def delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'pattern_ids is nil' if pattern_ids.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = {
    client_side_validation: true,
    required: true,
    serialized_name: 'patternIds',
    type: {
      name: 'Sequence',
      element: {
          client_side_validation: true,
          required: false,
          serialized_name: 'UuidElementType',
          type: {
            name: 'String'
          }
      }
    }
  }
  request_content = @client.serialize(request_mapper,  pattern_ids)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/patternrules'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#delete_patterns_with_http_info(app_id, version_id, pattern_ids, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a list of patterns in a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_ids

    The patterns IDs.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



555
556
557
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 555

def delete_patterns_with_http_info(app_id, version_id, pattern_ids, custom_headers:nil)
  delete_patterns_async(app_id, version_id, pattern_ids, custom_headers:custom_headers).value!
end

#list_intent_patterns(app_id, version_id, intent_id, skip: 0, take: 100, custom_headers: nil) ⇒ Array

Returns patterns for the specific intent in a version of the application.

  1. Default is 100.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • intent_id

    The intent classifier ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



866
867
868
869
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 866

def list_intent_patterns(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
  response = list_intent_patterns_async(app_id, version_id, intent_id, skip:skip, take:take, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_intent_patterns_async(app_id, version_id, intent_id, skip: 0, take: 100, custom_headers: nil) ⇒ Concurrent::Promise

Returns patterns for the specific intent in a version of the application.

  1. Default is 100.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • intent_id

    The intent classifier ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 903

def list_intent_patterns_async(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'intent_id is nil' if intent_id.nil?
  fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/intents/{intentId}/patternrules'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'intentId' => intent_id},
      query_params: {'skip' => skip,'take' => take},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PatternRuleInfoElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PatternRuleInfo'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_intent_patterns_with_http_info(app_id, version_id, intent_id, skip: 0, take: 100, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Returns patterns for the specific intent in a version of the application.

  1. Default is 100.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • intent_id

    The intent classifier ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



885
886
887
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 885

def list_intent_patterns_with_http_info(app_id, version_id, intent_id, skip:0, take:100, custom_headers:nil)
  list_intent_patterns_async(app_id, version_id, intent_id, skip:skip, take:take, custom_headers:custom_headers).value!
end

#list_patterns(app_id, version_id, skip: 0, take: 100, custom_headers: nil) ⇒ Array

Gets patterns in a version of the application.

  1. Default is 100.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



141
142
143
144
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 141

def list_patterns(app_id, version_id, skip:0, take:100, custom_headers:nil)
  response = list_patterns_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_patterns_async(app_id, version_id, skip: 0, take: 100, custom_headers: nil) ⇒ Concurrent::Promise

Gets patterns in a version of the application.

  1. Default is 100.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 176

def list_patterns_async(app_id, version_id, skip:0, take:100, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, "'skip' should satisfy the constraint - 'InclusiveMinimum': '0'" if !skip.nil? && skip < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '500'" if !take.nil? && take > 500
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/versions/{versionId}/patternrules'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      query_params: {'skip' => skip,'take' => take},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PatternRuleInfoElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PatternRuleInfo'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_patterns_with_http_info(app_id, version_id, skip: 0, take: 100, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets patterns in a version of the application.

  1. Default is 100.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • skip (Integer) (defaults to: 0)

    The number of entries to skip. Default value is 0.

  • take (Integer) (defaults to: 100)

    The number of entries to return. Maximum page size is

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



159
160
161
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 159

def list_patterns_with_http_info(app_id, version_id, skip:0, take:100, custom_headers:nil)
  list_patterns_async(app_id, version_id, skip:skip, take:take, custom_headers:custom_headers).value!
end

#update_pattern(app_id, version_id, pattern_id, pattern, custom_headers: nil) ⇒ PatternRuleInfo

Updates a pattern in a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • pattern (PatternRuleUpdateObject)

    An object representing a pattern.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (PatternRuleInfo)

    operation results.



659
660
661
662
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 659

def update_pattern(app_id, version_id, pattern_id, pattern, custom_headers:nil)
  response = update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers: nil) ⇒ Concurrent::Promise

Updates a pattern in a version of the application.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • pattern (PatternRuleUpdateObject)

    An object representing a pattern.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 692

def update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'pattern_id is nil' if pattern_id.nil?
  fail ArgumentError, 'pattern is nil' if pattern.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleUpdateObject.mapper()
  request_content = @client.serialize(request_mapper,  pattern)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/patternrules/{patternId}'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id,'patternId' => pattern_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::PatternRuleInfo.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#update_pattern_with_http_info(app_id, version_id, pattern_id, pattern, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a pattern in a version of the application.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • pattern_id

    The pattern ID.

  • pattern (PatternRuleUpdateObject)

    An object representing a pattern.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



676
677
678
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 676

def update_pattern_with_http_info(app_id, version_id, pattern_id, pattern, custom_headers:nil)
  update_pattern_async(app_id, version_id, pattern_id, pattern, custom_headers:custom_headers).value!
end

#update_patterns(app_id, version_id, patterns, custom_headers: nil) ⇒ Array

Updates patterns in a version of the application.

patterns. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleUpdateObject>)

    An array represents the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



262
263
264
265
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 262

def update_patterns(app_id, version_id, patterns, custom_headers:nil)
  response = update_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_patterns_async(app_id, version_id, patterns, custom_headers: nil) ⇒ Concurrent::Promise

Updates patterns in a version of the application.

patterns. to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleUpdateObject>)

    An array represents the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 295

def update_patterns_async(app_id, version_id, patterns, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?
  fail ArgumentError, 'version_id is nil' if version_id.nil?
  fail ArgumentError, 'patterns is nil' if patterns.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = {
    client_side_validation: true,
    required: true,
    serialized_name: 'patterns',
    type: {
      name: 'Sequence',
      element: {
          client_side_validation: true,
          required: false,
          serialized_name: 'PatternRuleUpdateObjectElementType',
          type: {
            name: 'Composite',
            class_name: 'PatternRuleUpdateObject'
          }
      }
    }
  }
  request_content = @client.serialize(request_mapper,  patterns)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/versions/{versionId}/patternrules'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id,'versionId' => version_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'PatternRuleInfoElementType',
                type: {
                  name: 'Composite',
                  class_name: 'PatternRuleInfo'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#update_patterns_with_http_info(app_id, version_id, patterns, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates patterns in a version of the application.

patterns. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • version_id (String)

    The version ID.

  • patterns (Array<PatternRuleUpdateObject>)

    An array represents the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



279
280
281
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/pattern.rb', line 279

def update_patterns_with_http_info(app_id, version_id, patterns, custom_headers:nil)
  update_patterns_async(app_id, version_id, patterns, custom_headers:custom_headers).value!
end