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 all commits
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
253 changes: 253 additions & 0 deletions model/equaliq.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,35 @@ 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?

GetComposerContractMeta
GetComposerContractContent
UpdateComposerContractMeta
UpdateComposerContractContent
SaveComposerContractToVault
ListComposerContracts
ListComposerContractVersions
ArchiveComposerContract
]

}

resource ComposerContract {
identifiers: { contractId: ComposerContractId }
create: CreateComposerContract
read: GetComposerContractMeta
update: UpdateComposerContractMeta
delete: ArchiveComposerContract
list: ListComposerContracts

operations: [
GetComposerContractContent,
UpdateComposerContractContent,
SaveComposerContractToVault,
ListComposerContractVersions
]
}

// When changing APIs, we sometimes want to expose unified types that aren't directly tied to any API.
structure ExposedTypes {
QASectionsList: QASectionsList
Expand All @@ -49,6 +74,12 @@ string ContractId
@pattern("^[A-Za-z0-9-]+$")
string UserId

@pattern("^[A-Fa-f0-9-]{36}$")
string ComposerContractId

@pattern("^[A-Fa-f0-9-]{36}$")
string RevisionId

list UserIdList {
member: UserId
}
Expand Down Expand Up @@ -98,6 +129,25 @@ 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

NEW
CLEAN_IN_VAULT
DIRTY
ARCHIVED
}

enum ComposerContractType {
PRODUCER
}

enum ComposerContractSection {
SERVICES
COMPENSATION
INTELLECTUAL_PROPERTY
TERM_AND_TERMINATION
CONFIDENTIALITY
}

// Contract operations
@http(method: "POST", uri: "/getContract")
operation GetContract {
Expand Down Expand Up @@ -217,6 +267,7 @@ structure ContractSummaryItem {
sharedWith: UserIdList
sharedUsers: UserIdList
sharedEmails: EmailList
isComposerGenerated: Boolean
}

@idempotent
Expand Down Expand Up @@ -698,3 +749,205 @@ structure DeleteContractSignatureOutput {
message: String
}

structure ComposerContractMeta {
contractId: ComposerContractId
revisionId: String
title: String
type: ComposerContractType
status: ComposerContractStatus
createdAt: Timestamp
updatedAt: Timestamp
revisionHistory: RevisionIdList
}

list RevisionIdList {
member: String
}

structure ComposerContractContent {
sections: ComposerContractSectionList
}

structure ComposerContractData {
meta: ComposerContractMeta
content: ComposerContractContent
}

list ComposerContractSectionList {
member: SectionUnion
}

union SectionUnion {
term: TermSection
clause: ClauseSection
// more structured section types
}

structure TermSection {
sectionId: ComposerContractSection
name: String
definition: String
citation: String
unit: String
}

structure ClauseSection {
sectionId: ComposerContractSection
text: String
}


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

structure CreateComposerContractInput {
@required
title: String
@required
type: ComposerContractType
formDetails: ComposerFormData
sourceRevisionId: RevisionId
}
structure CreateComposerContractOutput {
contract: ComposerContractData
}

structure ComposerFormData {
clientName: String
providerName: String
date: String
}

@readonly
@http(method: "POST", uri: "/composer/getMeta")
operation GetComposerContractMeta {
input: GetComposerContractInput
output: GetComposerContractMetaOutput
}

structure GetComposerContractMetaOutput {
meta: ComposerContractMeta
}

@http(method: "POST", uri: "/composer/getContent")
operation GetComposerContractContent {
input: GetComposerContractInput
output: GetComposerContractContentOutput
}
structure GetComposerContractInput {
@required
contractId: ComposerContractId
}

structure GetComposerContractContentOutput {
content: ComposerContractContent
}


@idempotent
@http(method: "POST", uri: "/composer/updateMeta")
operation UpdateComposerContractMeta {
input: UpdateComposerContractMetaInput
output: UpdateComposerContractMetaOutput
}

structure UpdateComposerContractMetaInput {
@required
contractId: ComposerContractId
title: String
sections: ComposerContractSectionList
status: ComposerContractStatus
}

structure UpdateComposerContractMetaOutput {
contract: ComposerContractData
}

@http(method: "POST", uri: "/composer/updateContent")
operation UpdateComposerContractContent {
input: UpdateComposerContractContentInput
output: UpdateComposerContractContentOutput
}

structure UpdateComposerContractContentInput {
@required
contractId: ComposerContractId
sections: ComposerContractSectionList
}

structure UpdateComposerContractContentOutput {
contract: ComposerContractData
}

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

structure ListComposerContractsInput {
// temp - ask Parker
}

list ComposerContractMetaList {
member: ComposerContractMeta
}

structure ListComposerContractsOutput {
contracts: ComposerContractMetaList
}

@http(method: "POST", uri: "/composer/listVersions")
operation ListComposerContractVersions {
input: GetComposerContractInput
output: ListComposerContractVersionsOutput
}

structure ListComposerContractVersionsOutput {
contractId: ComposerContractId
versions: ComposerContractMetaList
}

@http(method: "POST", uri: "/composer/publish")
operation SaveComposerContractToVault {
input: SaveComposerContractToVaultInput
output: SaveComposerContractToVaultOutput
}

structure SaveComposerContractToVaultInput {
@required
contractId: ComposerContractId
}

structure SaveComposerContractToVaultOutput {
@required
message: String
}

@idempotent
@http(method: "POST", uri: "/composer/archive")
operation ArchiveComposerContract {
input: ArchiveComposerContractInput
output: ArchiveComposerContractOutput
errors: [
AuthenticationError,
ResourceNotFoundError,
InternalServerError
]
}

structure ArchiveComposerContractInput {
@required
contractId: ComposerContractId
}

structure ArchiveComposerContractOutput {
@required
message: String
}

Loading