ecoportal-api-graphql 1.3.13 → 1.3.15
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.
- checksums.yaml +4 -4
- data/.ai-assistance/bridge/archive/oscar-a1b2c3d-gitlab-mcp-doc-update.inbox.md +29 -29
- data/.ai-assistance/bridge/archive/oscar-c912c25-gemini-design-review.inbox.md +42 -42
- data/.ai-assistance/projects/TODO.md +170 -118
- data/.ai-assistance/skills/ai-instructions/SKILL.md +48 -48
- data/.ai-assistance/skills/code-specs/SKILL.md +69 -69
- data/.ai-assistance/skills/gemini-assist/SKILL.md +63 -63
- data/.ai-assistance/skills/project-cycle/SKILL.md +177 -177
- data/.ai-assistance/skills/refactor/SKILL.md +62 -62
- data/.ai-assistance/skills/spec-generation/SKILL.md +72 -72
- data/.gitignore +37 -37
- data/.gitlab-ci.yml +64 -12
- data/CHANGELOG.md +77 -0
- data/changelog.d/fixed-mr51-payload-item-mismatches.md +17 -0
- data/docs/worklog.md +0 -18
- data/lib/ecoportal/api/common/graphql/client.rb +0 -2
- data/lib/ecoportal/api/common/graphql/http_client.rb +6 -0
- data/lib/ecoportal/api/graphql/base/ai_summary_version.rb +17 -17
- data/lib/ecoportal/api/graphql/base/location_classification_type.rb +15 -15
- data/lib/ecoportal/api/graphql/base/location_structure.rb +27 -27
- data/lib/ecoportal/api/graphql/base/organization.rb +15 -15
- data/lib/ecoportal/api/graphql/base/page/task.rb +24 -0
- data/lib/ecoportal/api/graphql/base/page.rb +17 -16
- data/lib/ecoportal/api/graphql/base/template.rb +35 -0
- data/lib/ecoportal/api/graphql/base.rb +37 -35
- data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +41 -41
- data/lib/ecoportal/api/graphql/compat/response.rb +35 -35
- data/lib/ecoportal/api/graphql/connection/action.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/action_category.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/contractor_entity.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/page.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/person_member.rb +11 -11
- data/lib/ecoportal/api/graphql/connection/preview_page.rb +11 -11
- data/lib/ecoportal/api/graphql/connection.rb +17 -17
- data/lib/ecoportal/api/graphql/file_upload/client.rb +21 -10
- data/lib/ecoportal/api/graphql/fragment/field_configuration.rb +38 -0
- data/lib/ecoportal/api/graphql/fragment/force.rb +14 -10
- data/lib/ecoportal/api/graphql/fragment/location_node.rb +26 -26
- data/lib/ecoportal/api/graphql/fragment/page_task.rb +39 -0
- data/lib/ecoportal/api/graphql/fragment/template.rb +51 -0
- data/lib/ecoportal/api/graphql/fragment.rb +3 -0
- data/lib/ecoportal/api/graphql/input/contractor_entity.rb +14 -14
- data/lib/ecoportal/api/graphql/input/workflow_command/add_stage.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_field_configuration.rb +21 -21
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_page.rb +28 -28
- data/lib/ecoportal/api/graphql/input/workflow_command/edit_page_creator_permissions.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/cross_reference.rb +23 -23
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/date.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/image_gallery.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/plain_text.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/rich_text.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/field_config/select.rb +20 -20
- data/lib/ecoportal/api/graphql/input/workflow_command/move_field.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/reorder_forces.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command/reorder_section.rb +18 -18
- data/lib/ecoportal/api/graphql/input/workflow_command.rb +251 -251
- data/lib/ecoportal/api/graphql/input.rb +24 -24
- data/lib/ecoportal/api/graphql/logic/connection.rb +34 -34
- data/lib/ecoportal/api/graphql/model/page/task.rb +16 -0
- data/lib/ecoportal/api/graphql/model/page.rb +16 -15
- data/lib/ecoportal/api/graphql/model/person_member.rb +15 -15
- data/lib/ecoportal/api/graphql/model/template.rb +15 -0
- data/lib/ecoportal/api/graphql/model.rb +32 -30
- data/lib/ecoportal/api/graphql/mutation/ai_summary/generate.rb +45 -45
- data/lib/ecoportal/api/graphql/mutation/ai_summary/submit_feedback.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +14 -14
- data/lib/ecoportal/api/graphql/mutation/page/approve_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/batch_update_review_task.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/create_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/delete_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/execute_force_commands.rb +7 -7
- data/lib/ecoportal/api/graphql/mutation/page/execute_workflow_commands.rb +8 -7
- data/lib/ecoportal/api/graphql/mutation/page/publish_draft.rb +38 -40
- data/lib/ecoportal/api/graphql/mutation/page/reject_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/restart_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/page/undo_review_task.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/preset_view/destroy.rb +34 -35
- data/lib/ecoportal/api/graphql/mutation/register/destroy.rb +35 -35
- data/lib/ecoportal/api/graphql/mutation/smart_fill/generate.rb +36 -36
- data/lib/ecoportal/api/graphql/mutation/smart_fill/submit_feedback.rb +40 -40
- data/lib/ecoportal/api/graphql/mutation/smart_fill.rb +13 -13
- data/lib/ecoportal/api/graphql/mutation/template/create_related_page.rb +46 -46
- data/lib/ecoportal/api/graphql/mutation/template/destroy_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation/template/update_information.rb +1 -1
- data/lib/ecoportal/api/graphql/mutation.rb +20 -20
- data/lib/ecoportal/api/graphql/payload/contractor_entity.rb +14 -14
- data/lib/ecoportal/api/graphql/payload/ok_payload.rb +36 -21
- data/lib/ecoportal/api/graphql/payload/page/draft.rb +26 -13
- data/lib/ecoportal/api/graphql/payload/page/review_task.rb +13 -13
- data/lib/ecoportal/api/graphql/payload/page/review_task_batch.rb +23 -0
- data/lib/ecoportal/api/graphql/payload/page.rb +20 -19
- data/lib/ecoportal/api/graphql/payload/preset_view.rb +15 -11
- data/lib/ecoportal/api/graphql/payload/register.rb +15 -11
- data/lib/ecoportal/api/graphql/payload/template/create_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/template/destroy_related_page.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/template/update_information.rb +1 -1
- data/lib/ecoportal/api/graphql/query/location_structures.rb +57 -57
- data/lib/ecoportal/api/graphql/query/page_with_forces.rb +9 -3
- data/lib/ecoportal/api/graphql/query/pages_workflow_commands.rb +9 -3
- data/lib/ecoportal/api/graphql/query/register_preset_views.rb +78 -78
- data/lib/ecoportal/api/graphql/query.rb +27 -27
- data/lib/ecoportal/api/graphql.rb +9 -5
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- data/tests/dump_schema.rb +88 -0
- data/tests/validate_queries.rb +34 -12
- metadata +11 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Base
|
|
5
|
-
class LocationStructure < Interface::LocationStructure::Nodes
|
|
6
|
-
read_only!
|
|
7
|
-
|
|
8
|
-
class_resolver :location_node_class, Base::LocationNode
|
|
9
|
-
class_resolver :draft_class, "Base::LocationStructure::Draft"
|
|
10
|
-
|
|
11
|
-
passkey :id
|
|
12
|
-
passthrough :name, :weight
|
|
13
|
-
passboolean :archived, :published, :visitorManagementEnabled
|
|
14
|
-
embeds_one :updatedAt, klass: Base::DateTime
|
|
15
|
-
|
|
16
|
-
embeds_many :drafts, klass: :draft_class, order_key: :createdAt
|
|
17
|
-
|
|
18
|
-
def draft?
|
|
19
|
-
false
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
require_relative 'location_structure/draft'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
class LocationStructure < Interface::LocationStructure::Nodes
|
|
6
|
+
read_only!
|
|
7
|
+
|
|
8
|
+
class_resolver :location_node_class, Base::LocationNode
|
|
9
|
+
class_resolver :draft_class, "Base::LocationStructure::Draft"
|
|
10
|
+
|
|
11
|
+
passkey :id
|
|
12
|
+
passthrough :name, :weight
|
|
13
|
+
passboolean :archived, :published, :visitorManagementEnabled
|
|
14
|
+
embeds_one :updatedAt, klass: Base::DateTime
|
|
15
|
+
|
|
16
|
+
embeds_many :drafts, klass: :draft_class, order_key: :createdAt
|
|
17
|
+
|
|
18
|
+
def draft?
|
|
19
|
+
false
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
require_relative 'location_structure/draft'
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Base
|
|
5
|
-
class Organization < Logic::BaseModel
|
|
6
|
-
root!
|
|
7
|
-
|
|
8
|
-
passkey :id
|
|
9
|
-
passthrough :name, :companyName
|
|
10
|
-
passthrough :logoUrl, read_only: true
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
class Organization < Logic::BaseModel
|
|
6
|
+
root!
|
|
7
|
+
|
|
8
|
+
passkey :id
|
|
9
|
+
passthrough :name, :companyName
|
|
10
|
+
passthrough :logoUrl, read_only: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
module Page
|
|
6
|
+
# A page TASK — the `item` of the review-task mutations (`TaskInterface`:
|
|
7
|
+
# CompletePage / InComment / ReviewPage). Read-only.
|
|
8
|
+
#
|
|
9
|
+
# This is NOT a page: the page it belongs to is `subject` (a PageUnion). The
|
|
10
|
+
# review-task payloads used to type `item` as `Model::PageUnion`, which never
|
|
11
|
+
# matched the schema (see `Fragment :PageTaskFields`).
|
|
12
|
+
class Task < Logic::BaseModel
|
|
13
|
+
read_only!
|
|
14
|
+
|
|
15
|
+
passkey :id
|
|
16
|
+
passthrough :__typename, :stageId, :relativeStatus, :taskNotes
|
|
17
|
+
passboolean :complete, :overdue, :escalated
|
|
18
|
+
passdate :createdAt, :completedAt, :due
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Base
|
|
5
|
-
module Page
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
require_relative 'page/basic'
|
|
13
|
-
require_relative 'page/data_field'
|
|
14
|
-
require_relative 'page/section'
|
|
15
|
-
require_relative 'page/section_collection'
|
|
16
|
-
require_relative 'page/phased'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
module Page
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
require_relative 'page/basic'
|
|
13
|
+
require_relative 'page/data_field'
|
|
14
|
+
require_relative 'page/section'
|
|
15
|
+
require_relative 'page/section_collection'
|
|
16
|
+
require_relative 'page/phased'
|
|
17
|
+
require_relative 'page/task'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
# Namespace for the narrow template-side types.
|
|
6
|
+
#
|
|
7
|
+
# ★ Note the platform asymmetry: in most of this gem a "template" IS a page (a page with
|
|
8
|
+
# `template: true`), which is why `Query::Templates` and most `Payload::Template::*`
|
|
9
|
+
# resolve to `Model::PageUnion`. The two types here are the exceptions — distinct schema
|
|
10
|
+
# types returned by specific template mutations.
|
|
11
|
+
module Template
|
|
12
|
+
# `item` of `updateTemplateInformation` (schema type `Template`). Read-only.
|
|
13
|
+
class Information < Logic::BaseModel
|
|
14
|
+
read_only!
|
|
15
|
+
|
|
16
|
+
passkey :id
|
|
17
|
+
passthrough :description, :aiDescription, :templateType, :templateContainerUid
|
|
18
|
+
passboolean :active, :public, :creatorEnabled, :creatorEditable
|
|
19
|
+
passarray :folders
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# `item` of `createTemplateRelatedPage` / `destroyTemplateRelatedPage`
|
|
23
|
+
# (schema type `RelatedPages`) — a related-pages CONFIG entry, not a page. Read-only.
|
|
24
|
+
class RelatedPages < Logic::BaseModel
|
|
25
|
+
read_only!
|
|
26
|
+
|
|
27
|
+
passkey :id
|
|
28
|
+
passthrough :title, :registerId
|
|
29
|
+
passboolean :hasInaccessibleVariables
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Base
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
require_relative 'base/date_time'
|
|
11
|
-
require_relative 'base/page_info'
|
|
12
|
-
require_relative 'base/location_classification_type'
|
|
13
|
-
require_relative 'base/location_node'
|
|
14
|
-
require_relative 'base/location_structure'
|
|
15
|
-
require_relative 'base/person_member'
|
|
16
|
-
require_relative 'base/file_attachment'
|
|
17
|
-
require_relative 'base/file_container'
|
|
18
|
-
require_relative 'base/field'
|
|
19
|
-
require_relative 'base/page'
|
|
20
|
-
require_relative 'base/resource'
|
|
21
|
-
require_relative 'base/action_category'
|
|
22
|
-
require_relative 'base/action'
|
|
23
|
-
require_relative 'base/contractor_entity'
|
|
24
|
-
require_relative 'base/preview_page'
|
|
25
|
-
require_relative 'base/delta_result'
|
|
26
|
-
require_relative 'base/organization'
|
|
27
|
-
|
|
28
|
-
require_relative 'base/register'
|
|
29
|
-
require_relative 'base/preset_view'
|
|
30
|
-
|
|
31
|
-
require_relative 'base/ai_summary_version'
|
|
32
|
-
|
|
33
|
-
require_relative 'base/force'
|
|
34
|
-
require_relative 'base/pages_workflow'
|
|
35
|
-
require_relative 'base/kickstand'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Base
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
require_relative 'base/date_time'
|
|
11
|
+
require_relative 'base/page_info'
|
|
12
|
+
require_relative 'base/location_classification_type'
|
|
13
|
+
require_relative 'base/location_node'
|
|
14
|
+
require_relative 'base/location_structure'
|
|
15
|
+
require_relative 'base/person_member'
|
|
16
|
+
require_relative 'base/file_attachment'
|
|
17
|
+
require_relative 'base/file_container'
|
|
18
|
+
require_relative 'base/field'
|
|
19
|
+
require_relative 'base/page'
|
|
20
|
+
require_relative 'base/resource'
|
|
21
|
+
require_relative 'base/action_category'
|
|
22
|
+
require_relative 'base/action'
|
|
23
|
+
require_relative 'base/contractor_entity'
|
|
24
|
+
require_relative 'base/preview_page'
|
|
25
|
+
require_relative 'base/delta_result'
|
|
26
|
+
require_relative 'base/organization'
|
|
27
|
+
|
|
28
|
+
require_relative 'base/register'
|
|
29
|
+
require_relative 'base/preset_view'
|
|
30
|
+
|
|
31
|
+
require_relative 'base/ai_summary_version'
|
|
32
|
+
|
|
33
|
+
require_relative 'base/force'
|
|
34
|
+
require_relative 'base/pages_workflow'
|
|
35
|
+
require_relative 'base/kickstand'
|
|
36
|
+
|
|
37
|
+
require_relative 'base/template'
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Builder
|
|
5
|
-
class ContractorEntity
|
|
6
|
-
attr_reader :client
|
|
7
|
-
|
|
8
|
-
def initialize(client)
|
|
9
|
-
@client = client
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def create(**kargs, &block)
|
|
13
|
-
createMutation.query(**kargs, &block)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def update(**kargs, &block)
|
|
17
|
-
updateMutation.query(**kargs, &block)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def destroy(**kargs, &block)
|
|
21
|
-
destroyMutation.query(**kargs, &block)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
private
|
|
25
|
-
|
|
26
|
-
def createMutation
|
|
27
|
-
Mutation::ContractorEntity::Create.new(client)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def updateMutation
|
|
31
|
-
Mutation::ContractorEntity::Update.new(client)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def destroyMutation
|
|
35
|
-
Mutation::ContractorEntity::Destroy.new(client)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Builder
|
|
5
|
+
class ContractorEntity
|
|
6
|
+
attr_reader :client
|
|
7
|
+
|
|
8
|
+
def initialize(client)
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def create(**kargs, &block)
|
|
13
|
+
createMutation.query(**kargs, &block)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def update(**kargs, &block)
|
|
17
|
+
updateMutation.query(**kargs, &block)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def destroy(**kargs, &block)
|
|
21
|
+
destroyMutation.query(**kargs, &block)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def createMutation
|
|
27
|
+
Mutation::ContractorEntity::Create.new(client)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def updateMutation
|
|
31
|
+
Mutation::ContractorEntity::Update.new(client)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def destroyMutation
|
|
35
|
+
Mutation::ContractorEntity::Destroy.new(client)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Compat
|
|
5
|
-
# Wraps a GraphQL mutation payload to expose the v2-compatible response interface.
|
|
6
|
-
# Scripts check .success? and .status after update/create operations.
|
|
7
|
-
class Response
|
|
8
|
-
def initialize(payload)
|
|
9
|
-
@payload = payload
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def success?
|
|
13
|
-
@payload.success?
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def error?
|
|
17
|
-
@payload.error?
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def status
|
|
21
|
-
@payload.error? ? :error : :ok
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def body
|
|
25
|
-
@payload.error_doc
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def item
|
|
29
|
-
@payload.item
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Compat
|
|
5
|
+
# Wraps a GraphQL mutation payload to expose the v2-compatible response interface.
|
|
6
|
+
# Scripts check .success? and .status after update/create operations.
|
|
7
|
+
class Response
|
|
8
|
+
def initialize(payload)
|
|
9
|
+
@payload = payload
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def success?
|
|
13
|
+
@payload.success?
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def error?
|
|
17
|
+
@payload.error?
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def status
|
|
21
|
+
@payload.error? ? :error : :ok
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def body
|
|
25
|
+
@payload.error_doc
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def item
|
|
29
|
+
@payload.item
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class Action < Logic::Connection
|
|
6
|
-
class_resolver :node_class, Model::Action
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class Action < Logic::Connection
|
|
6
|
+
class_resolver :node_class, Model::Action
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class ActionCategory < Logic::Connection
|
|
6
|
-
class_resolver :node_class, Base::ActionCategory
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class ActionCategory < Logic::Connection
|
|
6
|
+
class_resolver :node_class, Base::ActionCategory
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class ContractorEntity < Logic::Connection
|
|
6
|
-
class_resolver :node_class, Model::ContractorEntity
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class ContractorEntity < Logic::Connection
|
|
6
|
+
class_resolver :node_class, Model::ContractorEntity
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class Page < Logic::Connection
|
|
6
|
-
class_resolver :node_class, 'Ecoportal::API::GraphQL::Model::PageUnion'
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class Page < Logic::Connection
|
|
6
|
+
class_resolver :node_class, 'Ecoportal::API::GraphQL::Model::PageUnion'
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class PersonMemberConnection < Logic::Connection
|
|
6
|
-
class_resolver :node_class, Model::PersonMember
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class PersonMemberConnection < Logic::Connection
|
|
6
|
+
class_resolver :node_class, Model::PersonMember
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
class PreviewPage < Logic::Connection
|
|
6
|
-
class_resolver :node_class, 'Ecoportal::API::GraphQL::Model::PreviewPage'
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
end
|
|
11
|
-
end
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
class PreviewPage < Logic::Connection
|
|
6
|
+
class_resolver :node_class, 'Ecoportal::API::GraphQL::Model::PreviewPage'
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
module Ecoportal
|
|
2
|
-
module API
|
|
3
|
-
class GraphQL
|
|
4
|
-
module Connection
|
|
5
|
-
end
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
require_relative 'connection/person_member'
|
|
11
|
-
require_relative 'connection/contractor_entity'
|
|
12
|
-
require_relative 'connection/action_category'
|
|
13
|
-
require_relative 'connection/action'
|
|
14
|
-
require_relative 'connection/page'
|
|
15
|
-
require_relative 'connection/preview_page'
|
|
16
|
-
require_relative 'connection/preset_view'
|
|
17
|
-
require_relative 'connection/pages_workflow_command'
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class GraphQL
|
|
4
|
+
module Connection
|
|
5
|
+
end
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
require_relative 'connection/person_member'
|
|
11
|
+
require_relative 'connection/contractor_entity'
|
|
12
|
+
require_relative 'connection/action_category'
|
|
13
|
+
require_relative 'connection/action'
|
|
14
|
+
require_relative 'connection/page'
|
|
15
|
+
require_relative 'connection/preview_page'
|
|
16
|
+
require_relative 'connection/preset_view'
|
|
17
|
+
require_relative 'connection/pages_workflow_command'
|
|
@@ -22,7 +22,12 @@ module Ecoportal
|
|
|
22
22
|
# page.components.get_by_name('Attachment').file_container_ids = [container_id]
|
|
23
23
|
# api.pages.update(page)
|
|
24
24
|
#
|
|
25
|
-
#
|
|
25
|
+
# Step 1 (GraphQL) authenticates via the gem's email/pass OAuth bearer token.
|
|
26
|
+
# Steps 3-4 (REST v2 `/s3/files`) require the gem to ALSO have been initialised
|
|
27
|
+
# with `api_key:` — `Ecoportal::API::GraphQL.new(email:, pass:, api_key:)` — since
|
|
28
|
+
# those endpoints authenticate via `X-ECOPORTAL-API-KEY`, not the GraphQL bearer
|
|
29
|
+
# token (mirrors `Ecoportal::API::Common::Content::Client#base_request` in
|
|
30
|
+
# ecoportal-api-v2).
|
|
26
31
|
class Client
|
|
27
32
|
POLL_INTERVAL = 2 # seconds between poll attempts
|
|
28
33
|
POLL_MAX_WAIT = 120 # seconds before giving up
|
|
@@ -111,10 +116,16 @@ module Ecoportal
|
|
|
111
116
|
end
|
|
112
117
|
end
|
|
113
118
|
|
|
114
|
-
# --- REST helpers (v2 endpoints,
|
|
119
|
+
# --- REST helpers (v2 endpoints, X-ECOPORTAL-API-KEY auth) ---
|
|
115
120
|
|
|
116
|
-
def
|
|
117
|
-
@
|
|
121
|
+
def api_key
|
|
122
|
+
@api_key ||= @http_client.api_key.tap do |key|
|
|
123
|
+
if key.nil? || key.to_s.strip.empty?
|
|
124
|
+
raise 'File upload requires an api_key: Ecoportal::API::GraphQL.new(email:, pass:, api_key:). ' \
|
|
125
|
+
'The v2 REST endpoints used to register/poll an upload authenticate via ' \
|
|
126
|
+
'X-ECOPORTAL-API-KEY, not the GraphQL OAuth bearer token.'
|
|
127
|
+
end
|
|
128
|
+
end
|
|
118
129
|
end
|
|
119
130
|
|
|
120
131
|
def upload_base_url
|
|
@@ -124,18 +135,18 @@ module Ecoportal
|
|
|
124
135
|
def upload_get(path)
|
|
125
136
|
uri = URI("#{upload_base_url}#{path}")
|
|
126
137
|
request = Net::HTTP::Get.new(uri)
|
|
127
|
-
request['
|
|
128
|
-
request['Accept']
|
|
138
|
+
request['X-ECOPORTAL-API-KEY'] = api_key
|
|
139
|
+
request['Accept'] = 'application/json'
|
|
129
140
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
|
|
130
141
|
end
|
|
131
142
|
|
|
132
143
|
def upload_post(path, body)
|
|
133
144
|
uri = URI("#{upload_base_url}#{path}")
|
|
134
145
|
request = Net::HTTP::Post.new(uri)
|
|
135
|
-
request['
|
|
136
|
-
request['Content-Type']
|
|
137
|
-
request['Accept']
|
|
138
|
-
request.body
|
|
146
|
+
request['X-ECOPORTAL-API-KEY'] = api_key
|
|
147
|
+
request['Content-Type'] = 'application/json'
|
|
148
|
+
request['Accept'] = 'application/json'
|
|
149
|
+
request.body = JSON.generate(body)
|
|
139
150
|
Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
|
|
140
151
|
end
|
|
141
152
|
|