|
| 1 | +# typed: false |
| 2 | +# frozen_string_literal: true |
| 3 | + |
| 4 | +######################################################################################################################## |
| 5 | +# This file is auto-generated. If you have an issue, please create a GitHub issue. # |
| 6 | +######################################################################################################################## |
| 7 | + |
| 8 | +module ShopifyAPI |
| 9 | + class Report < ShopifyAPI::Rest::Base |
| 10 | + extend T::Sig |
| 11 | + |
| 12 | + @prev_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) |
| 13 | + @next_page_info = T.let(Concurrent::ThreadLocalVar.new { nil }, Concurrent::ThreadLocalVar) |
| 14 | + |
| 15 | + sig { params(session: T.nilable(ShopifyAPI::Auth::Session)).void } |
| 16 | + def initialize(session: ShopifyAPI::Context.active_session) |
| 17 | + super(session: session) |
| 18 | + |
| 19 | + @category = T.let(nil, T.nilable(String)) |
| 20 | + @id = T.let(nil, T.nilable(Integer)) |
| 21 | + @name = T.let(nil, T.nilable(String)) |
| 22 | + @shopify_ql = T.let(nil, T.nilable(String)) |
| 23 | + @updated_at = T.let(nil, T.nilable(String)) |
| 24 | + end |
| 25 | + |
| 26 | + @has_one = T.let({}, T::Hash[Symbol, Class]) |
| 27 | + @has_many = T.let({}, T::Hash[Symbol, Class]) |
| 28 | + @paths = T.let([ |
| 29 | + {http_method: :delete, operation: :delete, ids: [:id], path: "reports/<id>.json"}, |
| 30 | + {http_method: :get, operation: :get, ids: [], path: "reports.json"}, |
| 31 | + {http_method: :get, operation: :get, ids: [:id], path: "reports/<id>.json"}, |
| 32 | + {http_method: :post, operation: :post, ids: [], path: "reports.json"}, |
| 33 | + {http_method: :put, operation: :put, ids: [:id], path: "reports/<id>.json"} |
| 34 | + ], T::Array[T::Hash[String, T.any(T::Array[Symbol], String, Symbol)]]) |
| 35 | + |
| 36 | + sig { returns(T.nilable(String)) } |
| 37 | + attr_reader :category |
| 38 | + sig { returns(T.nilable(Integer)) } |
| 39 | + attr_reader :id |
| 40 | + sig { returns(T.nilable(String)) } |
| 41 | + attr_reader :name |
| 42 | + sig { returns(T.nilable(String)) } |
| 43 | + attr_reader :shopify_ql |
| 44 | + sig { returns(T.nilable(String)) } |
| 45 | + attr_reader :updated_at |
| 46 | + |
| 47 | + class << self |
| 48 | + sig do |
| 49 | + params( |
| 50 | + id: T.any(Integer, String), |
| 51 | + fields: T.untyped, |
| 52 | + session: Auth::Session |
| 53 | + ).returns(T.nilable(Report)) |
| 54 | + end |
| 55 | + def find( |
| 56 | + id:, |
| 57 | + fields: nil, |
| 58 | + session: ShopifyAPI::Context.active_session |
| 59 | + ) |
| 60 | + result = base_find( |
| 61 | + session: session, |
| 62 | + ids: {id: id}, |
| 63 | + params: {fields: fields}, |
| 64 | + ) |
| 65 | + T.cast(result[0], T.nilable(Report)) |
| 66 | + end |
| 67 | + |
| 68 | + sig do |
| 69 | + params( |
| 70 | + id: T.any(Integer, String), |
| 71 | + session: Auth::Session |
| 72 | + ).returns(T.untyped) |
| 73 | + end |
| 74 | + def delete( |
| 75 | + id:, |
| 76 | + session: ShopifyAPI::Context.active_session |
| 77 | + ) |
| 78 | + request( |
| 79 | + http_method: :delete, |
| 80 | + operation: :delete, |
| 81 | + session: session, |
| 82 | + ids: {id: id}, |
| 83 | + params: {}, |
| 84 | + ) |
| 85 | + end |
| 86 | + |
| 87 | + sig do |
| 88 | + params( |
| 89 | + ids: T.untyped, |
| 90 | + limit: T.untyped, |
| 91 | + since_id: T.untyped, |
| 92 | + updated_at_min: T.untyped, |
| 93 | + updated_at_max: T.untyped, |
| 94 | + fields: T.untyped, |
| 95 | + session: Auth::Session, |
| 96 | + kwargs: T.untyped |
| 97 | + ).returns(T::Array[Report]) |
| 98 | + end |
| 99 | + def all( |
| 100 | + ids: nil, |
| 101 | + limit: nil, |
| 102 | + since_id: nil, |
| 103 | + updated_at_min: nil, |
| 104 | + updated_at_max: nil, |
| 105 | + fields: nil, |
| 106 | + session: ShopifyAPI::Context.active_session, |
| 107 | + **kwargs |
| 108 | + ) |
| 109 | + response = base_find( |
| 110 | + session: session, |
| 111 | + ids: {}, |
| 112 | + params: {ids: ids, limit: limit, since_id: since_id, updated_at_min: updated_at_min, updated_at_max: updated_at_max, fields: fields}.merge(kwargs).compact, |
| 113 | + ) |
| 114 | + |
| 115 | + T.cast(response, T::Array[Report]) |
| 116 | + end |
| 117 | + |
| 118 | + end |
| 119 | + |
| 120 | + end |
| 121 | +end |
0 commit comments