Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
metadata-hubspot
Browse files Browse the repository at this point in the history
  • Loading branch information
sumanthreddyc committed Feb 23, 2024
1 parent a8e619c commit ed16e23
Show file tree
Hide file tree
Showing 6 changed files with 457 additions and 9 deletions.
186 changes: 186 additions & 0 deletions packages/sdk/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,51 @@
}
}
}
},
"post": {
"operationId": "crm-metadataCreateObjectsSchema",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/crm.metaCustomObject"
}
}
}
},
"responses": {
"201": {
"description": "Custom object created successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/crm.metaCustomObject"
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
},
"/crm/v2/metadata/properties": {
Expand Down Expand Up @@ -1911,6 +1956,147 @@
}
}
}
},
"/crm/v2/metadata/associations": {
"post": {
"operationId": "crm-metadataUpsertAssociation",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"record": {
"type": "object",
"properties": {
"name": {
"type": ["string", "null"],
"example": "My Company"
},
"domain": {
"type": ["string", "null"],
"example": "mycompany.com"
},
"owner_id": {
"type": ["string", "null"],
"example": "9f3e97fd-4d5d-4efc-959d-bbebfac079f5"
},
"account_id": {
"type": ["string", "null"],
"example": "ae4be028-9078-4850-a0bf-d2112b7c4d11"
},
"custom_fields": {
"type": ["object", "null"],
"additionalProperties": {}
}
}
},
"upsert_on": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the account to upsert on. Supported for Outreach, Salesloft, and Apollo."
},
"domain": {
"type": "string",
"description": "The domain of the account to upsert on. Only supported for Outreach and Salesloft."
}
}
}
},
"required": ["record", "upsert_on"]
}
}
}
},
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"completedAt": {
"type": "string",
"format": "date-time"
},
"requestedAt": {
"type": "string",
"format": "date-time"
},
"startedAt": {
"type": "string",
"format": "date-time"
},
"links": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"results": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"to": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"type": {
"type": "string"
}
},
"required": ["from", "to", "type"]
}
},
"status": {
"type": "string",
"enum": ["PENDING", "COMPLETED", "FAILED"]
}
},
"required": ["completedAt", "requestedAt", "startedAt", "status", "results"]
}
}
}
},
"400": {
"description": "Invalid input data",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.BAD_REQUEST"
}
}
}
},
"500": {
"description": "Internal server error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/error.INTERNAL_SERVER_ERROR"
}
}
}
}
}
}
}
},
"components": {
Expand Down
3 changes: 3 additions & 0 deletions packages/vdk/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ export async function proxyCallProvider({
})

// verticals.salesEngagement.listContacts -> listContacts
console.log('ctx.path:', ctx.path)
const methodName = ctx.path.split('.').pop() ?? ''
console.log('methodName:', methodName)
console.log('instance:', instance)
const implementation = ctx.provider?.[methodName] as Function

if (typeof implementation !== 'function') {
Expand Down
9 changes: 7 additions & 2 deletions verticals/vertical-crm/commonModels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {z, zBaseRecord} from '@supaglue/vdk'
export const account = zBaseRecord
.extend({
name: z.string().nullish(),
domain: z.string().nullish(),
})
.openapi({ref: 'crm.account'})

Expand All @@ -19,13 +20,17 @@ export const lead = zBaseRecord
})
.openapi({ref: 'crm.lead'})

export const opportunity = zBaseRecord
export const opportunity = zBaseRecord
.extend({
name: z.string().nullish(),
closedate: z.string().nullish(),
amount: z.string().nullish(),
pipeline: z.string().nullish(),
dealstage: z.string().nullish(),
})
.openapi({ref: 'crm.opportunity'})

export const user = zBaseRecord
export const user = zBaseRecord
.extend({
name: z.string().nullish(),
})
Expand Down
Loading

0 comments on commit ed16e23

Please sign in to comment.