dodopayments 2.9.0 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/digital_product_delivery.rb +14 -7
  5. data/lib/dodopayments/models/digital_product_delivery_file.rb +12 -5
  6. data/lib/dodopayments/models/entitlement.rb +31 -20
  7. data/lib/dodopayments/models/entitlement_create_params.rb +3 -3
  8. data/lib/dodopayments/models/entitlement_grant_created_webhook_event.rb +6 -1
  9. data/lib/dodopayments/models/entitlement_grant_delivered_webhook_event.rb +6 -1
  10. data/lib/dodopayments/models/entitlement_grant_failed_webhook_event.rb +6 -1
  11. data/lib/dodopayments/models/entitlement_grant_revoked_webhook_event.rb +6 -1
  12. data/lib/dodopayments/models/entitlement_update_params.rb +3 -3
  13. data/lib/dodopayments/models/entitlements/entitlement_grant.rb +50 -32
  14. data/lib/dodopayments/models/entitlements/file_upload_response.rb +3 -3
  15. data/lib/dodopayments/models/entitlements/license_key_grant.rb +14 -9
  16. data/lib/dodopayments/models/integration_config.rb +70 -27
  17. data/lib/dodopayments/models/integration_config_response.rb +88 -48
  18. data/lib/dodopayments/models/product.rb +3 -5
  19. data/lib/dodopayments/models/product_entitlement_summary.rb +5 -5
  20. data/lib/dodopayments/models/webhook_payload.rb +5 -0
  21. data/lib/dodopayments/resources/entitlements/files.rb +3 -10
  22. data/lib/dodopayments/resources/entitlements/grants.rb +2 -4
  23. data/lib/dodopayments/resources/entitlements.rb +2 -2
  24. data/lib/dodopayments/version.rb +1 -1
  25. data/rbi/dodopayments/models/digital_product_delivery.rbi +15 -5
  26. data/rbi/dodopayments/models/digital_product_delivery_file.rbi +11 -0
  27. data/rbi/dodopayments/models/entitlement.rbi +35 -20
  28. data/rbi/dodopayments/models/entitlement_create_params.rbi +8 -5
  29. data/rbi/dodopayments/models/entitlement_grant_created_webhook_event.rbi +4 -0
  30. data/rbi/dodopayments/models/entitlement_grant_delivered_webhook_event.rbi +4 -0
  31. data/rbi/dodopayments/models/entitlement_grant_failed_webhook_event.rbi +4 -0
  32. data/rbi/dodopayments/models/entitlement_grant_revoked_webhook_event.rbi +4 -0
  33. data/rbi/dodopayments/models/entitlement_update_params.rbi +4 -4
  34. data/rbi/dodopayments/models/entitlements/entitlement_grant.rbi +54 -20
  35. data/rbi/dodopayments/models/entitlements/file_upload_response.rbi +4 -4
  36. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +10 -4
  37. data/rbi/dodopayments/models/integration_config.rbi +141 -26
  38. data/rbi/dodopayments/models/integration_config_response.rbi +153 -38
  39. data/rbi/dodopayments/models/product.rbi +4 -8
  40. data/rbi/dodopayments/models/product_entitlement_summary.rbi +8 -8
  41. data/rbi/dodopayments/models/webhook_payload.rbi +2 -0
  42. data/rbi/dodopayments/resources/entitlements/files.rbi +3 -10
  43. data/rbi/dodopayments/resources/entitlements/grants.rbi +2 -4
  44. data/rbi/dodopayments/resources/entitlements.rbi +4 -4
  45. data/sig/dodopayments/models/entitlement.rbs +8 -10
  46. data/sig/dodopayments/models/entitlement_create_params.rbs +6 -4
  47. data/sig/dodopayments/models/entitlements/entitlement_grant.rbs +4 -11
  48. data/sig/dodopayments/models/integration_config.rbs +28 -4
  49. data/sig/dodopayments/models/integration_config_response.rbs +28 -9
  50. data/sig/dodopayments/resources/entitlements.rbs +1 -1
  51. metadata +2 -2
@@ -4,14 +4,11 @@ module Dodopayments
4
4
  module Resources
5
5
  class Entitlements
6
6
  class Files
7
- # Companion to `post_entitlement_file`. Deletes the file from the Entitlements
8
- # Engine (force=true) and atomically removes the `file_id` from the entitlement's
9
- # `integration_config.digital_file_ids` JSONB array. EE delete happens first; if
10
- # it fails we surface the error and leave local state untouched.
7
+ # Detach a previously-attached file from a `digital_files` entitlement.
11
8
  #
12
9
  # @overload delete(file_id, id:, request_options: {})
13
10
  #
14
- # @param file_id [String] Digital file Id from EE
11
+ # @param file_id [String] Identifier of the attached file
15
12
  #
16
13
  # @param id [String] Entitlement Id
17
14
  #
@@ -34,11 +31,7 @@ module Dodopayments
34
31
  )
35
32
  end
36
33
 
37
- # Streams a multipart/form-data body to the Entitlements Engine
38
- # (`POST /api/digital-files/dodo/files/upload`) and appends the returned `file_id`
39
- # to the entitlement's `integration_config.digital_file_ids` using a JSONB array
40
- # append. Compensates EE-side on local DB write failure (best-effort delete of the
41
- # just-uploaded file).
34
+ # Attach a file to a `digital_files` entitlement. Per-file size cap: 500 MiB.
42
35
  #
43
36
  # @overload upload(id, request_options: {})
44
37
  #
@@ -36,10 +36,8 @@ module Dodopayments
36
36
  )
37
37
  end
38
38
 
39
- # Revokes a single entitlement grant for the caller's business. For LicenseKey
40
- # integrations, also disables the backing license key. Idempotent: re-revoking an
41
- # already-revoked grant returns 200 with current state. The revocation reason is
42
- # always set to "manual" for API-initiated revocations.
39
+ # Revoke a single grant. Idempotent: re-revoking an already-revoked grant returns
40
+ # the grant in its current state.
43
41
  #
44
42
  # @overload revoke(grant_id, id:, request_options: {})
45
43
  #
@@ -21,7 +21,7 @@ module Dodopayments
21
21
  #
22
22
  # @param description [String, nil] Optional description
23
23
  #
24
- # @param metadata [Hash{Symbol=>String}, nil] Optional user-facing metadata
24
+ # @param metadata [Hash{Symbol=>String}] Additional metadata for the entitlement
25
25
  #
26
26
  # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
27
27
  #
@@ -70,7 +70,7 @@ module Dodopayments
70
70
  #
71
71
  # @param description [String, nil]
72
72
  #
73
- # @param integration_config [Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig, nil] Platform-specific configuration for an entitlement.
73
+ # @param integration_config [Dodopayments::Models::IntegrationConfig::GitHubConfig, Dodopayments::Models::IntegrationConfig::DiscordConfig, Dodopayments::Models::IntegrationConfig::TelegramConfig, Dodopayments::Models::IntegrationConfig::FigmaConfig, Dodopayments::Models::IntegrationConfig::FramerConfig, Dodopayments::Models::IntegrationConfig::NotionConfig, Dodopayments::Models::IntegrationConfig::DigitalFilesConfig, Dodopayments::Models::IntegrationConfig::LicenseKeyConfig, nil] Integration-specific configuration supplied when creating or updating
74
74
  #
75
75
  # @param metadata [Hash{Symbol=>String}, nil]
76
76
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dodopayments
4
- VERSION = "2.9.0"
4
+ VERSION = "2.9.1"
5
5
  end
@@ -11,19 +11,21 @@ module Dodopayments
11
11
  )
12
12
  end
13
13
 
14
+ # One entry per attached file.
14
15
  sig { returns(T::Array[Dodopayments::DigitalProductDeliveryFile]) }
15
16
  attr_accessor :files
16
17
 
18
+ # Optional external URL, passed through from the entitlement configuration.
17
19
  sig { returns(T.nilable(String)) }
18
20
  attr_accessor :external_url
19
21
 
22
+ # Optional human-readable delivery instructions, passed through from the
23
+ # entitlement configuration.
20
24
  sig { returns(T.nilable(String)) }
21
25
  attr_accessor :instructions
22
26
 
23
- # Digital-product-delivery payload for a grant. Populated for grants whose
24
- # entitlement has `integration_type = 'digital_files'`. `files` carries presigned
25
- # download URLs; the source (EE service or legacy in-process S3 presigning) is
26
- # opaque to the caller.
27
+ # Digital-product-delivery payload, present on grants for `digital_files`
28
+ # entitlements. Each file carries a short-lived presigned download URL.
27
29
  sig do
28
30
  params(
29
31
  files: T::Array[Dodopayments::DigitalProductDeliveryFile::OrHash],
@@ -31,7 +33,15 @@ module Dodopayments
31
33
  instructions: T.nilable(String)
32
34
  ).returns(T.attached_class)
33
35
  end
34
- def self.new(files:, external_url: nil, instructions: nil)
36
+ def self.new(
37
+ # One entry per attached file.
38
+ files:,
39
+ # Optional external URL, passed through from the entitlement configuration.
40
+ external_url: nil,
41
+ # Optional human-readable delivery instructions, passed through from the
42
+ # entitlement configuration.
43
+ instructions: nil
44
+ )
35
45
  end
36
46
 
37
47
  sig do
@@ -11,6 +11,7 @@ module Dodopayments
11
11
  )
12
12
  end
13
13
 
14
+ # Short-lived presigned URL for downloading the file.
14
15
  sig { returns(String) }
15
16
  attr_accessor :download_url
16
17
 
@@ -18,18 +19,23 @@ module Dodopayments
18
19
  sig { returns(Integer) }
19
20
  attr_accessor :expires_in
20
21
 
22
+ # Identifier of the attached file.
21
23
  sig { returns(String) }
22
24
  attr_accessor :file_id
23
25
 
26
+ # Original filename of the attached file.
24
27
  sig { returns(String) }
25
28
  attr_accessor :filename
26
29
 
30
+ # Optional content-type declared at upload.
27
31
  sig { returns(T.nilable(String)) }
28
32
  attr_accessor :content_type
29
33
 
34
+ # Optional size of the file in bytes.
30
35
  sig { returns(T.nilable(Integer)) }
31
36
  attr_accessor :file_size
32
37
 
38
+ # One file in a digital-product delivery payload.
33
39
  sig do
34
40
  params(
35
41
  download_url: String,
@@ -41,12 +47,17 @@ module Dodopayments
41
47
  ).returns(T.attached_class)
42
48
  end
43
49
  def self.new(
50
+ # Short-lived presigned URL for downloading the file.
44
51
  download_url:,
45
52
  # Seconds until `download_url` expires.
46
53
  expires_in:,
54
+ # Identifier of the attached file.
47
55
  file_id:,
56
+ # Original filename of the attached file.
48
57
  filename:,
58
+ # Optional content-type declared at upload.
49
59
  content_type: nil,
60
+ # Optional size of the file in bytes.
50
61
  file_size: nil
51
62
  )
52
63
  end
@@ -8,43 +8,50 @@ module Dodopayments
8
8
  T.any(Dodopayments::Entitlement, Dodopayments::Internal::AnyHash)
9
9
  end
10
10
 
11
+ # Unique identifier of the entitlement.
11
12
  sig { returns(String) }
12
13
  attr_accessor :id
13
14
 
15
+ # Identifier of the business that owns this entitlement.
14
16
  sig { returns(String) }
15
17
  attr_accessor :business_id
16
18
 
19
+ # Timestamp when the entitlement was created.
17
20
  sig { returns(Time) }
18
21
  attr_accessor :created_at
19
22
 
20
- # Public-facing variant of [`IntegrationConfig`]. Mirrors every variant shape on
21
- # the wire EXCEPT `DigitalFiles`, which is replaced with a hydrated
22
- # `digital_files` object (resolved download URLs etc.). The persisted JSONB stays
23
- # ID-only via [`IntegrationConfig`]; this enum is response-only.
23
+ # Integration-specific configuration. For `digital_files` entitlements this
24
+ # includes presigned download URLs for each attached file.
24
25
  sig { returns(Dodopayments::IntegrationConfigResponse::Variants) }
25
26
  attr_accessor :integration_config
26
27
 
28
+ # Platform integration this entitlement uses.
27
29
  sig { returns(Dodopayments::EntitlementIntegrationType::TaggedSymbol) }
28
30
  attr_accessor :integration_type
29
31
 
32
+ # Always `true` for entitlements returned by the public API; soft-deleted
33
+ # entitlements are not returned.
30
34
  sig { returns(T::Boolean) }
31
35
  attr_accessor :is_active
32
36
 
37
+ # Arbitrary key-value metadata supplied at creation or via PATCH.
38
+ sig { returns(T::Hash[Symbol, String]) }
39
+ attr_accessor :metadata
40
+
41
+ # Display name supplied at creation.
33
42
  sig { returns(String) }
34
43
  attr_accessor :name
35
44
 
45
+ # Timestamp when the entitlement was last modified.
36
46
  sig { returns(Time) }
37
47
  attr_accessor :updated_at
38
48
 
49
+ # Optional description supplied at creation.
39
50
  sig { returns(T.nilable(String)) }
40
51
  attr_accessor :description
41
52
 
42
- sig { returns(T.nilable(T.anything)) }
43
- attr_reader :metadata
44
-
45
- sig { params(metadata: T.anything).void }
46
- attr_writer :metadata
47
-
53
+ # Detailed view of a single entitlement: identity, integration type,
54
+ # integration-specific configuration, and metadata.
48
55
  sig do
49
56
  params(
50
57
  id: String,
@@ -63,27 +70,35 @@ module Dodopayments
63
70
  ),
64
71
  integration_type: Dodopayments::EntitlementIntegrationType::OrSymbol,
65
72
  is_active: T::Boolean,
73
+ metadata: T::Hash[Symbol, String],
66
74
  name: String,
67
75
  updated_at: Time,
68
- description: T.nilable(String),
69
- metadata: T.anything
76
+ description: T.nilable(String)
70
77
  ).returns(T.attached_class)
71
78
  end
72
79
  def self.new(
80
+ # Unique identifier of the entitlement.
73
81
  id:,
82
+ # Identifier of the business that owns this entitlement.
74
83
  business_id:,
84
+ # Timestamp when the entitlement was created.
75
85
  created_at:,
76
- # Public-facing variant of [`IntegrationConfig`]. Mirrors every variant shape on
77
- # the wire EXCEPT `DigitalFiles`, which is replaced with a hydrated
78
- # `digital_files` object (resolved download URLs etc.). The persisted JSONB stays
79
- # ID-only via [`IntegrationConfig`]; this enum is response-only.
86
+ # Integration-specific configuration. For `digital_files` entitlements this
87
+ # includes presigned download URLs for each attached file.
80
88
  integration_config:,
89
+ # Platform integration this entitlement uses.
81
90
  integration_type:,
91
+ # Always `true` for entitlements returned by the public API; soft-deleted
92
+ # entitlements are not returned.
82
93
  is_active:,
94
+ # Arbitrary key-value metadata supplied at creation or via PATCH.
95
+ metadata:,
96
+ # Display name supplied at creation.
83
97
  name:,
98
+ # Timestamp when the entitlement was last modified.
84
99
  updated_at:,
85
- description: nil,
86
- metadata: nil
100
+ # Optional description supplied at creation.
101
+ description: nil
87
102
  )
88
103
  end
89
104
 
@@ -98,10 +113,10 @@ module Dodopayments
98
113
  integration_type:
99
114
  Dodopayments::EntitlementIntegrationType::TaggedSymbol,
100
115
  is_active: T::Boolean,
116
+ metadata: T::Hash[Symbol, String],
101
117
  name: String,
102
118
  updated_at: Time,
103
- description: T.nilable(String),
104
- metadata: T.anything
119
+ description: T.nilable(String)
105
120
  }
106
121
  )
107
122
  end
@@ -43,9 +43,12 @@ module Dodopayments
43
43
  sig { returns(T.nilable(String)) }
44
44
  attr_accessor :description
45
45
 
46
- # Optional user-facing metadata
46
+ # Additional metadata for the entitlement
47
47
  sig { returns(T.nilable(T::Hash[Symbol, String])) }
48
- attr_accessor :metadata
48
+ attr_reader :metadata
49
+
50
+ sig { params(metadata: T::Hash[Symbol, String]).void }
51
+ attr_writer :metadata
49
52
 
50
53
  sig do
51
54
  params(
@@ -63,7 +66,7 @@ module Dodopayments
63
66
  integration_type: Dodopayments::EntitlementIntegrationType::OrSymbol,
64
67
  name: String,
65
68
  description: T.nilable(String),
66
- metadata: T.nilable(T::Hash[Symbol, String]),
69
+ metadata: T::Hash[Symbol, String],
67
70
  request_options: Dodopayments::RequestOptions::OrHash
68
71
  ).returns(T.attached_class)
69
72
  end
@@ -76,7 +79,7 @@ module Dodopayments
76
79
  name:,
77
80
  # Optional description
78
81
  description: nil,
79
- # Optional user-facing metadata
82
+ # Additional metadata for the entitlement
80
83
  metadata: nil,
81
84
  request_options: {}
82
85
  )
@@ -100,7 +103,7 @@ module Dodopayments
100
103
  Dodopayments::EntitlementIntegrationType::OrSymbol,
101
104
  name: String,
102
105
  description: T.nilable(String),
103
- metadata: T.nilable(T::Hash[Symbol, String]),
106
+ metadata: T::Hash[Symbol, String],
104
107
  request_options: Dodopayments::RequestOptions
105
108
  }
106
109
  )
@@ -15,6 +15,8 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
19
+ # and any integration-specific delivery payload.
18
20
  sig { returns(Dodopayments::Entitlements::EntitlementGrant) }
19
21
  attr_reader :data
20
22
 
@@ -47,6 +49,8 @@ module Dodopayments
47
49
  def self.new(
48
50
  # The business identifier
49
51
  business_id:,
52
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
53
+ # and any integration-specific delivery payload.
50
54
  data:,
51
55
  # The timestamp of when the event occurred
52
56
  timestamp:,
@@ -15,6 +15,8 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
19
+ # and any integration-specific delivery payload.
18
20
  sig { returns(Dodopayments::Entitlements::EntitlementGrant) }
19
21
  attr_reader :data
20
22
 
@@ -47,6 +49,8 @@ module Dodopayments
47
49
  def self.new(
48
50
  # The business identifier
49
51
  business_id:,
52
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
53
+ # and any integration-specific delivery payload.
50
54
  data:,
51
55
  # The timestamp of when the event occurred
52
56
  timestamp:,
@@ -15,6 +15,8 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
19
+ # and any integration-specific delivery payload.
18
20
  sig { returns(Dodopayments::Entitlements::EntitlementGrant) }
19
21
  attr_reader :data
20
22
 
@@ -46,6 +48,8 @@ module Dodopayments
46
48
  def self.new(
47
49
  # The business identifier
48
50
  business_id:,
51
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
52
+ # and any integration-specific delivery payload.
49
53
  data:,
50
54
  # The timestamp of when the event occurred
51
55
  timestamp:,
@@ -15,6 +15,8 @@ module Dodopayments
15
15
  sig { returns(String) }
16
16
  attr_accessor :business_id
17
17
 
18
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
19
+ # and any integration-specific delivery payload.
18
20
  sig { returns(Dodopayments::Entitlements::EntitlementGrant) }
19
21
  attr_reader :data
20
22
 
@@ -47,6 +49,8 @@ module Dodopayments
47
49
  def self.new(
48
50
  # The business identifier
49
51
  business_id:,
52
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
53
+ # and any integration-specific delivery payload.
50
54
  data:,
51
55
  # The timestamp of when the event occurred
52
56
  timestamp:,
@@ -20,8 +20,8 @@ module Dodopayments
20
20
  sig { returns(T.nilable(String)) }
21
21
  attr_accessor :description
22
22
 
23
- # Platform-specific configuration for an entitlement. Each variant uses unique
24
- # field names so `#[serde(untagged)]` can disambiguate correctly.
23
+ # Integration-specific configuration supplied when creating or updating an
24
+ # entitlement. The shape required matches the entitlement's `integration_type`.
25
25
  sig do
26
26
  returns(
27
27
  T.nilable(
@@ -71,8 +71,8 @@ module Dodopayments
71
71
  def self.new(
72
72
  id:,
73
73
  description: nil,
74
- # Platform-specific configuration for an entitlement. Each variant uses unique
75
- # field names so `#[serde(untagged)]` can disambiguate correctly.
74
+ # Integration-specific configuration supplied when creating or updating an
75
+ # entitlement. The shape required matches the entitlement's `integration_type`.
76
76
  integration_config: nil,
77
77
  metadata: nil,
78
78
  name: nil,
@@ -14,24 +14,31 @@ module Dodopayments
14
14
  )
15
15
  end
16
16
 
17
+ # Unique identifier of the grant.
17
18
  sig { returns(String) }
18
19
  attr_accessor :id
19
20
 
21
+ # Identifier of the business that owns the grant.
20
22
  sig { returns(String) }
21
23
  attr_accessor :business_id
22
24
 
25
+ # Timestamp when the grant was created.
23
26
  sig { returns(Time) }
24
27
  attr_accessor :created_at
25
28
 
29
+ # Identifier of the customer the grant was issued to.
26
30
  sig { returns(String) }
27
31
  attr_accessor :customer_id
28
32
 
33
+ # Identifier of the entitlement this grant was issued from.
29
34
  sig { returns(String) }
30
35
  attr_accessor :entitlement_id
31
36
 
32
- sig { returns(String) }
33
- attr_accessor :external_id
37
+ # Arbitrary key-value metadata recorded on the grant.
38
+ sig { returns(T::Hash[Symbol, String]) }
39
+ attr_accessor :metadata
34
40
 
41
+ # Lifecycle status of the grant.
35
42
  sig do
36
43
  returns(
37
44
  Dodopayments::Entitlements::EntitlementGrant::Status::TaggedSymbol
@@ -39,14 +46,16 @@ module Dodopayments
39
46
  end
40
47
  attr_accessor :status
41
48
 
49
+ # Timestamp when the grant was last modified.
42
50
  sig { returns(Time) }
43
51
  attr_accessor :updated_at
44
52
 
53
+ # Timestamp when the grant transitioned to `delivered`, when applicable.
45
54
  sig { returns(T.nilable(Time)) }
46
55
  attr_accessor :delivered_at
47
56
 
48
- # Present only when the entitlement integration_type is `digital_files`. Populated
49
- # eagerly on every list and single-record endpoint.
57
+ # Digital-product-delivery payload, present when the entitlement integration is
58
+ # `digital_files`.
50
59
  sig { returns(T.nilable(Dodopayments::DigitalProductDelivery)) }
51
60
  attr_reader :digital_product_delivery
52
61
 
@@ -58,13 +67,16 @@ module Dodopayments
58
67
  end
59
68
  attr_writer :digital_product_delivery
60
69
 
70
+ # Machine-readable code reported when delivery failed, when applicable.
61
71
  sig { returns(T.nilable(String)) }
62
72
  attr_accessor :error_code
63
73
 
74
+ # Human-readable message reported when delivery failed, when applicable.
64
75
  sig { returns(T.nilable(String)) }
65
76
  attr_accessor :error_message
66
77
 
67
- # Present only when the entitlement integration_type is `license_key`.
78
+ # License-key delivery payload, present when the entitlement integration is
79
+ # `license_key`.
68
80
  sig { returns(T.nilable(Dodopayments::Entitlements::LicenseKeyGrant)) }
69
81
  attr_reader :license_key
70
82
 
@@ -76,30 +88,34 @@ module Dodopayments
76
88
  end
77
89
  attr_writer :license_key
78
90
 
79
- sig { returns(T.nilable(T.anything)) }
80
- attr_reader :metadata
81
-
82
- sig { params(metadata: T.anything).void }
83
- attr_writer :metadata
84
-
91
+ # Timestamp when `oauth_url` stops being valid, when applicable.
85
92
  sig { returns(T.nilable(Time)) }
86
93
  attr_accessor :oauth_expires_at
87
94
 
95
+ # Customer-facing OAuth URL for OAuth-style integrations. Populated during the
96
+ # customer-portal accept flow; `null` until the customer completes that step, and
97
+ # on grants for non-OAuth integrations.
88
98
  sig { returns(T.nilable(String)) }
89
99
  attr_accessor :oauth_url
90
100
 
101
+ # Identifier of the payment that triggered this grant, when applicable.
91
102
  sig { returns(T.nilable(String)) }
92
103
  attr_accessor :payment_id
93
104
 
105
+ # Reason recorded when the grant was revoked, when applicable.
94
106
  sig { returns(T.nilable(String)) }
95
107
  attr_accessor :revocation_reason
96
108
 
109
+ # Timestamp when the grant transitioned to `revoked`, when applicable.
97
110
  sig { returns(T.nilable(Time)) }
98
111
  attr_accessor :revoked_at
99
112
 
113
+ # Identifier of the subscription that triggered this grant, when applicable.
100
114
  sig { returns(T.nilable(String)) }
101
115
  attr_accessor :subscription_id
102
116
 
117
+ # Detailed view of a single entitlement grant: who it's for, its lifecycle state,
118
+ # and any integration-specific delivery payload.
103
119
  sig do
104
120
  params(
105
121
  id: String,
@@ -107,7 +123,7 @@ module Dodopayments
107
123
  created_at: Time,
108
124
  customer_id: String,
109
125
  entitlement_id: String,
110
- external_id: String,
126
+ metadata: T::Hash[Symbol, String],
111
127
  status:
112
128
  Dodopayments::Entitlements::EntitlementGrant::Status::OrSymbol,
113
129
  updated_at: Time,
@@ -118,7 +134,6 @@ module Dodopayments
118
134
  error_message: T.nilable(String),
119
135
  license_key:
120
136
  T.nilable(Dodopayments::Entitlements::LicenseKeyGrant::OrHash),
121
- metadata: T.anything,
122
137
  oauth_expires_at: T.nilable(Time),
123
138
  oauth_url: T.nilable(String),
124
139
  payment_id: T.nilable(String),
@@ -128,28 +143,47 @@ module Dodopayments
128
143
  ).returns(T.attached_class)
129
144
  end
130
145
  def self.new(
146
+ # Unique identifier of the grant.
131
147
  id:,
148
+ # Identifier of the business that owns the grant.
132
149
  business_id:,
150
+ # Timestamp when the grant was created.
133
151
  created_at:,
152
+ # Identifier of the customer the grant was issued to.
134
153
  customer_id:,
154
+ # Identifier of the entitlement this grant was issued from.
135
155
  entitlement_id:,
136
- external_id:,
156
+ # Arbitrary key-value metadata recorded on the grant.
157
+ metadata:,
158
+ # Lifecycle status of the grant.
137
159
  status:,
160
+ # Timestamp when the grant was last modified.
138
161
  updated_at:,
162
+ # Timestamp when the grant transitioned to `delivered`, when applicable.
139
163
  delivered_at: nil,
140
- # Present only when the entitlement integration_type is `digital_files`. Populated
141
- # eagerly on every list and single-record endpoint.
164
+ # Digital-product-delivery payload, present when the entitlement integration is
165
+ # `digital_files`.
142
166
  digital_product_delivery: nil,
167
+ # Machine-readable code reported when delivery failed, when applicable.
143
168
  error_code: nil,
169
+ # Human-readable message reported when delivery failed, when applicable.
144
170
  error_message: nil,
145
- # Present only when the entitlement integration_type is `license_key`.
171
+ # License-key delivery payload, present when the entitlement integration is
172
+ # `license_key`.
146
173
  license_key: nil,
147
- metadata: nil,
174
+ # Timestamp when `oauth_url` stops being valid, when applicable.
148
175
  oauth_expires_at: nil,
176
+ # Customer-facing OAuth URL for OAuth-style integrations. Populated during the
177
+ # customer-portal accept flow; `null` until the customer completes that step, and
178
+ # on grants for non-OAuth integrations.
149
179
  oauth_url: nil,
180
+ # Identifier of the payment that triggered this grant, when applicable.
150
181
  payment_id: nil,
182
+ # Reason recorded when the grant was revoked, when applicable.
151
183
  revocation_reason: nil,
184
+ # Timestamp when the grant transitioned to `revoked`, when applicable.
152
185
  revoked_at: nil,
186
+ # Identifier of the subscription that triggered this grant, when applicable.
153
187
  subscription_id: nil
154
188
  )
155
189
  end
@@ -162,7 +196,7 @@ module Dodopayments
162
196
  created_at: Time,
163
197
  customer_id: String,
164
198
  entitlement_id: String,
165
- external_id: String,
199
+ metadata: T::Hash[Symbol, String],
166
200
  status:
167
201
  Dodopayments::Entitlements::EntitlementGrant::Status::TaggedSymbol,
168
202
  updated_at: Time,
@@ -173,7 +207,6 @@ module Dodopayments
173
207
  error_message: T.nilable(String),
174
208
  license_key:
175
209
  T.nilable(Dodopayments::Entitlements::LicenseKeyGrant),
176
- metadata: T.anything,
177
210
  oauth_expires_at: T.nilable(Time),
178
211
  oauth_url: T.nilable(String),
179
212
  payment_id: T.nilable(String),
@@ -186,6 +219,7 @@ module Dodopayments
186
219
  def to_hash
187
220
  end
188
221
 
222
+ # Lifecycle status of the grant.
189
223
  module Status
190
224
  extend Dodopayments::Internal::Type::Enum
191
225
 
@@ -12,15 +12,15 @@ module Dodopayments
12
12
  )
13
13
  end
14
14
 
15
- # EE-issued digital file id; appended to
16
- # `entitlements.integration_config.digital_file_ids`.
15
+ # Identifier of the attached file. Pass it to
16
+ # `DELETE /entitlements/{id}/files/{file_id}` to detach the file later.
17
17
  sig { returns(String) }
18
18
  attr_accessor :file_id
19
19
 
20
20
  sig { params(file_id: String).returns(T.attached_class) }
21
21
  def self.new(
22
- # EE-issued digital file id; appended to
23
- # `entitlements.integration_config.digital_file_ids`.
22
+ # Identifier of the attached file. Pass it to
23
+ # `DELETE /entitlements/{id}/files/{file_id}` to detach the file later.
24
24
  file_id:
25
25
  )
26
26
  end