Skip to content

Commit

Permalink
Add Attributes Field to BeamClaimType (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
enjinabner authored Nov 16, 2023
1 parent 3f987a4 commit 081db96
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en/type.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@
'beam_scan.field.message' => 'The message to sign.',
'beam_scan.field.walletPublicKey' => 'The wallet public key.',
'integer_range.description' => "A string value that can be used to represent a range of integer numbers. Use a double full stop to supply a range between 2 integers. \n\nExample \[\"1\",\"2\",\"3..8\"\]",
'attribute.description' => 'An initial attribute to set for the token when minting on demand.',
];
36 changes: 36 additions & 0 deletions src/GraphQL/Types/AttributeType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Enjin\Platform\Beam\GraphQL\Types;

use Rebing\GraphQL\Support\Facades\GraphQL;

class AttributeType extends Type
{
/**
* Get the type's attributes.
*/
public function attributes(): array
{
return [
'name' => 'AttributeType',
'description' => __('enjin-platform-beam::type.attribute.description'),
];
}

/**
* Get the type's fields definition.
*/
public function fields(): array
{
return [
'key' => [
'type' => GraphQL::type('String'),
'description' => __('enjin-platform::mutation.batch_set_attribute.args.key'),
],
'value' => [
'type' => GraphQL::type('String'),
'description' => __('enjin-platform::mutation.batch_set_attribute.args.value'),
],
];
}
}
4 changes: 4 additions & 0 deletions src/GraphQL/Types/BeamClaimType.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ public function fields(): array
'is_relation' => false,
'excludeFrom' => ['GetBeam', 'GetBeams'],
],
'attributes' => [
'type' => GraphQL::type('[AttributeType]'),
'description' => __('enjin-platform-beam::type.attribute.description'),
],
];
}
}
4 changes: 4 additions & 0 deletions tests/Feature/GraphQL/Resources/GetClaims.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ query GetClaims(
claimStatus
quantity
identifierCode
attributes {
key
value
}
wallet {
account {
publicKey
Expand Down

0 comments on commit 081db96

Please sign in to comment.