### WARNING: This file is auto-generated by our OpenAPI spec. Do not
### edit it manually.

require_relative '../../resource_includes/response_helper'

{{#operations}}
module Asana
  module Resources
    class {{classname}}Base < Resource

      def self.inherited(base)
        Registry.register(base)
      end

      class << self
{{#operation}}{{^formParams}}
{{#contents}}
        # {{#summary}}{{{.}}}{{/summary}}{{^summary}}{{operationId}}{{/summary}}
        #
        {{#pathParams}}
        # {{paramName}} - [{{dataType}}] {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}}{{/pathParams}}{{#queryParams}}{{#neq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}}
        # {{paramName}} - [{{~dataType~}}] {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}}{{/neq}}{{/queryParams}}
        # options - [Hash] the request I/O options{{#queryParams}}{{#eq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}}
        # > {{paramName}} - [{{~dataType~}}] {{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}{{#description}} {{{description}}}{{/description}}{{/eq}}{{/queryParams}}
        {{#eq httpMethod 'POST' 'PUT'}}
        # data - [Hash] the attributes to {{httpMethod}}
        {{/eq}}
        def {{operationId}}(client, {{#pathParams}}{{paramName}}: required("{{paramName}}"), {{/pathParams}}{{#queryParams}}{{#neq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}}{{paramName}}: nil, {{/neq}}{{/queryParams}}options: {}{{#eq httpMethod 'POST' 'PUT'}}, **data{{/eq}})
          path = "{{path}}"{{#pathParams}}
          path["{ {{~baseName~}} }"] = {{paramName}}{{/pathParams}}{{^moreThanCommon queryParams}}
          params = { {{#queryParams}}{{#neq baseName 'opt_pretty' 'opt_fields' 'offset' 'limit'}}{{#unless @first}}, {{/unless}}{{#neq paramName (fixSearchParams paramName)}}"{{/neq}}{{fixSearchParams paramName}}{{#neq paramName (fixSearchParams paramName)}}"{{/neq}}: {{paramName}}{{/neq}}{{/queryParams}} }.reject { |_,v| v.nil? || Array(v).empty? }{{/moreThanCommon}}
          {{#returnContainer}}Collection.new({{/returnContainer}}{{^returnContainer}}{{#firstClassResponseObject returnType}}{{firstClassResponseObject returnType}}.new({{/firstClassResponseObject}}{{/returnContainer}}parse(client.{{toLowerCase httpMethod}}(path, {{^moreThanCommon queryParams}}params: params, {{/moreThanCommon}}{{#eq httpMethod 'POST' 'PUT'}}body: data, {{/eq}}{{#queryParams.length}}params: params, {{/queryParams.length}}options: options)){{^returnContainer}}.first{{/returnContainer}}{{#returnContainer}}, type: {{#if (firstClassResponseObject returnType)}}{{firstClassResponseObject returnType}}{{else}}Resource{{/if}}{{/returnContainer}}{{#returnContainer}}, client: client){{/returnContainer}}{{^returnContainer}}{{#firstClassResponseObject returnType}}, client: client){{/firstClassResponseObject}}{{/returnContainer}}
        end

{{/contents}}
{{/formParams}}{{/operation}}
      end
    end
  end
end
{{/operations}}
