Skip to content

feat: contract composer apis #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions model/equaliq.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ service EqualIQ {
GetContractSignatures
UpdateSignatureStatus
DeleteContractSignature
CreateComposerContract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use smithy Resources?

UpdateComposerContract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split out different kinds of updates?

ListComposerContracts
GetComposerContract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split different kinds of Gets? Maybe we should use Meta vs Content?

SubmitComposerContractForAnalysis
DeleteComposerContract
]

}
Expand Down Expand Up @@ -98,6 +104,18 @@ enum SignContractResult {
FAILURE
}

enum ComposerContractStatus {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall Flow that we want to pursue:
From Dashboard -> Go to Composer Home Page
From Composer Home Page -> Edit Existing Composer Contracts or make a new one
From New Button -> Go to initial form to select contract type, provide basic details -> 'Create'
From 'Create' or 'Edit Existing' -> Go to Composer View

Composer View -> Export to Vault, View Exports
-- Should be able to see old versions which were exported to Vault in Composer
From Vault -> If it's from Composer, should be able to go to composer

DRAFT
FINALIZED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should treat this more like a cache structure for now:

NEW
CLEAN_IN_VAULT
DIRTY
ARCHIVED

SUBMITTED
ANALYZED
}

enum ComposerContractResult {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this necessary?

SUCCESS
FAILURE
}

// Contract operations
@http(method: "POST", uri: "/getContract")
operation GetContract {
Expand Down Expand Up @@ -698,3 +716,130 @@ structure DeleteContractSignatureOutput {
message: String
}


structure ComposerContractSection {
sectionId: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum

name: String
content: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of 'name'/'content' let's add specific structured type for each section with the required fields.

plainTextSummary: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave this in the frontend for now

}

structure ComposerContract {
contractId: ContractId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ComposerContractId : uuid ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a revisionId

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can put the list of revision ids in the Meta object.

title: String
type: ContractType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to separate this out into like a 'ComposerContractType'
Mayowa suggested Producer and Management agreements to start

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're going to start with just producer.

sections: ComposerContractSectionList
status: ComposerContractStatus
createdAt: Timestamp
updatedAt: Timestamp
}

list ComposerContractList {
member: ComposerContract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split out a Metadata type so that we don't need the full composer data for every item in the list

}

list ComposerContractSectionList {
member: ComposerContractSection
}

@idempotent
@http(method: "POST", uri: "/composer/create")
operation CreateComposerContract {
input: CreateComposerContractInput
output: CreateComposerContractOutput
}

structure CreateComposerContractInput {
@required
title: String
@required
type: ContractType
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should take the input form details as well

}

structure CreateComposerContractOutput {
contract: ComposerContract
}

@idempotent
@http(method: "POST", uri: "/composer/update")
operation UpdateComposerContract {
input: UpdateComposerContractInput
output: UpdateComposerContractOutput
}

structure UpdateComposerContractInput {
@required
contractId: ContractId
title: String
sections: ComposerContractSectionList
status: ComposerContractStatus
}

structure UpdateComposerContractOutput {
contract: ComposerContract
}

@http(method: "POST", uri: "/composer/list")
operation ListComposerContracts {
input: ListComposerContractsInput
output: ListComposerContractsOutput
}

structure ListComposerContractsInput {}

structure ListComposerContractsOutput {
contracts: ComposerContractList
}

@http(method: "POST", uri: "/composer/get")
operation GetComposerContract {
input: GetComposerContractInput
output: GetComposerContractOutput
}

structure GetComposerContractInput {
@required
contractId: ContractId
}

structure GetComposerContractOutput {
contract: ComposerContract
}

@http(method: "POST", uri: "/composer/submit")
operation SubmitComposerContractForAnalysis {
input: SubmitComposerContractForAnalysisInput
output: SubmitComposerContractForAnalysisOutput
}

structure SubmitComposerContractForAnalysisInput {
@required
contractId: ContractId
}

structure SubmitComposerContractForAnalysisOutput {
@required
success: ComposerContractResult
}

@idempotent
@http(method: "POST", uri: "/composer/delete")
operation DeleteComposerContract {
input: DeleteComposerContractInput
output: DeleteComposerContractOutput
errors: [
AuthenticationError,
ResourceNotFoundError,
InternalServerError
]
}

structure DeleteComposerContractInput {
@required
contractId: ContractId
}

structure DeleteComposerContractOutput {
@required
success: ComposerContractResult
}
116 changes: 91 additions & 25 deletions python/api_model/types/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generated by datamodel-codegen:
# filename: api.json
# timestamp: 2025-05-26T18:04:34+00:00
# timestamp: 2025-05-27T20:37:14+00:00

from __future__ import annotations

Expand All @@ -22,6 +22,25 @@ class AuthenticationErrorResponseContent(BaseModel):
message: str


class ComposerContractResult(Enum):
SUCCESS = 'SUCCESS'
FAILURE = 'FAILURE'


class ComposerContractSection(BaseModel):
sectionId: Optional[str] = None
name: Optional[str] = None
content: Optional[str] = None
plainTextSummary: Optional[str] = None


class ComposerContractStatus(Enum):
DRAFT = 'DRAFT'
FINALIZED = 'FINALIZED'
SUBMITTED = 'SUBMITTED'
ANALYZED = 'ANALYZED'


class ContractStatus(Enum):
processing = 'processing'
complete = 'complete'
Expand All @@ -45,6 +64,19 @@ class ContractType(Enum):
tbd = 'tbd'


class CreateComposerContractRequestContent(BaseModel):
title: str
type: ContractType


class DeleteComposerContractRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')


class DeleteComposerContractResponseContent(BaseModel):
success: ComposerContractResult


class DeleteContractRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')

Expand All @@ -53,6 +85,10 @@ class DeleteContractResponseContent(BaseModel):
success: bool


class DeleteContractSignatureRequestContent(BaseModel):
contractId: str


class FixedTermValue(BaseModel):
unit: str
value: str
Expand All @@ -66,8 +102,8 @@ class FixedValueTermInference(BaseModel):
subterms: Optional[List[FixedTermValue]] = None


class DeleteContractSignatureRequestContent(BaseModel):
contractId: str
class GetComposerContractRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')


class GetContractReadURLRequestContent(BaseModel):
Expand Down Expand Up @@ -145,14 +181,6 @@ class SharedUserDetails(BaseModel):
sharedTime: float


class Term(BaseModel):
name: str
definition: str
unitType: str
citation: Optional[str] = None
fixedValues: Optional[FixedValueTermInference] = None


class SignContractResult(Enum):
SUCCESS = 'SUCCESS'
FAILURE = 'FAILURE'
Expand All @@ -164,6 +192,29 @@ class SignatureStatus(Enum):
pending = 'pending'


class SubmitComposerContractForAnalysisRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')


class SubmitComposerContractForAnalysisResponseContent(BaseModel):
success: ComposerContractResult


class Term(BaseModel):
name: str
definition: str
unitType: str
citation: Optional[str] = None
fixedValues: Optional[FixedValueTermInference] = None


class UpdateComposerContractRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
title: Optional[str] = None
sections: Optional[List[ComposerContractSection]] = None
status: Optional[ComposerContractStatus] = None


class UpdateContractRequestContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
name: str
Expand Down Expand Up @@ -223,6 +274,16 @@ class ValidationErrorResponseContent(BaseModel):
message: str


class ComposerContract(BaseModel):
contractId: Optional[str] = Field(None, pattern='^[A-Za-z0-9-]+$')
title: Optional[str] = None
type: Optional[ContractType] = None
sections: Optional[List[ComposerContractSection]] = None
status: Optional[ComposerContractStatus] = None
createdAt: Optional[float] = None
updatedAt: Optional[float] = None


class ContractSignature(BaseModel):
userId: Optional[str] = None
status: Optional[SignatureStatus] = None
Expand All @@ -242,10 +303,23 @@ class ContractSummaryItem(BaseModel):
sharedEmails: Optional[List[str]] = None


class CreateComposerContractResponseContent(BaseModel):
contract: Optional[ComposerContract] = None


class DeleteContractSignatureResponseContent(BaseModel):
result: Optional[SignContractResult] = None
message: Optional[str] = None


class ExposeTypesResponseContent(BaseModel):
QASectionsList: Optional[List[QASection]] = None


class GetComposerContractResponseContent(BaseModel):
contract: Optional[ComposerContract] = None


class GetContractResponseContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
name: str
Expand All @@ -257,11 +331,6 @@ class GetContractResponseContent(BaseModel):
sharedWith: List[SharedWithItem]


class DeleteContractSignatureResponseContent(BaseModel):
result: Optional[SignContractResult] = None
message: Optional[str] = None


class GetContractSignaturesResponseContent(BaseModel):
contractId: Optional[str] = None
signatures: Optional[List[ContractSignature]] = None
Expand All @@ -276,6 +345,10 @@ class GetUploadURLResponseContent(BaseModel):
url_info: PresignedPostData


class ListComposerContractsResponseContent(BaseModel):
contracts: Optional[List[ComposerContract]] = None


class ListContractsResponseContent(BaseModel):
owned: List[ContractSummaryItem]
shared: List[ContractSummaryItem]
Expand All @@ -300,12 +373,5 @@ class SignContractResponseContent(BaseModel):
message: Optional[str] = None


class GetContractResponseContent(BaseModel):
contractId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
name: str
type: ContractType
terms: Any
iq_qa: QASections
isOwner: bool
ownerId: str = Field(..., pattern='^[A-Za-z0-9-]+$')
sharedWith: List[SharedWithItem]
class UpdateComposerContractResponseContent(BaseModel):
contract: Optional[ComposerContract] = None
Loading