package
0.0.0-20241119235852-f4fd2375174d
Repository: https://github.com/stripedapps/attio-go-sdk.git
Documentation: pkg.go.dev

# README

Go API client for openapi

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 2.0.0
  • Package version: 1.0.0
  • Generator version: 7.9.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://attio.com/help

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/stripedapps/attio-go-sdk"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.attio.com

ClassMethodHTTP requestDescription
AttributesAPIV2TargetIdentifierAttributesAttributeGetGet /v2/{target}/{identifier}/attributes/{attribute}Get an attribute
AttributesAPIV2TargetIdentifierAttributesAttributeOptionsGetGet /v2/{target}/{identifier}/attributes/{attribute}/optionsList select options
AttributesAPIV2TargetIdentifierAttributesAttributeOptionsOptionPatchPatch /v2/{target}/{identifier}/attributes/{attribute}/options/{option}Update a select option
AttributesAPIV2TargetIdentifierAttributesAttributeOptionsPostPost /v2/{target}/{identifier}/attributes/{attribute}/optionsCreate a select option
AttributesAPIV2TargetIdentifierAttributesAttributePatchPatch /v2/{target}/{identifier}/attributes/{attribute}Update an attribute
AttributesAPIV2TargetIdentifierAttributesAttributeStatusesGetGet /v2/{target}/{identifier}/attributes/{attribute}/statusesList statuses
AttributesAPIV2TargetIdentifierAttributesAttributeStatusesPostPost /v2/{target}/{identifier}/attributes/{attribute}/statusesCreate a status
AttributesAPIV2TargetIdentifierAttributesAttributeStatusesStatusPatchPatch /v2/{target}/{identifier}/attributes/{attribute}/statuses/{status}Update a status
AttributesAPIV2TargetIdentifierAttributesGetGet /v2/{target}/{identifier}/attributesList attributes
AttributesAPIV2TargetIdentifierAttributesPostPost /v2/{target}/{identifier}/attributesCreate an attribute
CommentsAPIV2CommentsCommentIdDeleteDelete /v2/comments/{comment_id}Delete a comment
CommentsAPIV2CommentsCommentIdGetGet /v2/comments/{comment_id}Get a comment
CommentsAPIV2CommentsPostPost /v2/commentsCreate a comment
EntriesAPIV2ListsListEntriesEntryIdAttributesAttributeValuesGetGet /v2/lists/{list}/entries/{entry_id}/attributes/{attribute}/valuesList attribute values for a list entry
EntriesAPIV2ListsListEntriesEntryIdDeleteDelete /v2/lists/{list}/entries/{entry_id}Delete a list entry
EntriesAPIV2ListsListEntriesEntryIdGetGet /v2/lists/{list}/entries/{entry_id}Get a list entry
EntriesAPIV2ListsListEntriesEntryIdPatchPatch /v2/lists/{list}/entries/{entry_id}Update a list entry (append multiselect values)
EntriesAPIV2ListsListEntriesEntryIdPutPut /v2/lists/{list}/entries/{entry_id}Update a list entry (overwrite multiselect values)
EntriesAPIV2ListsListEntriesPostPost /v2/lists/{list}/entriesCreate an entry (add record to list)
EntriesAPIV2ListsListEntriesPutPut /v2/lists/{list}/entriesAssert a list entry by parent
EntriesAPIV2ListsListEntriesQueryPostPost /v2/lists/{list}/entries/queryList entries
ListsAPIV2ListsGetGet /v2/listsList all lists
ListsAPIV2ListsListGetGet /v2/lists/{list}Get a list
ListsAPIV2ListsListPatchPatch /v2/lists/{list}Update a list
ListsAPIV2ListsPostPost /v2/listsCreate a list
MetaAPIV2SelfGetGet /v2/selfIdentify
NotesAPIV2NotesGetGet /v2/notesList notes
NotesAPIV2NotesNoteIdDeleteDelete /v2/notes/{note_id}Delete a note
NotesAPIV2NotesNoteIdGetGet /v2/notes/{note_id}Get a note
NotesAPIV2NotesPostPost /v2/notesCreate a note
ObjectsAPIV2ObjectsGetGet /v2/objectsList objects
ObjectsAPIV2ObjectsObjectGetGet /v2/objects/{object}Get an object
ObjectsAPIV2ObjectsObjectPatchPatch /v2/objects/{object}Update an object
ObjectsAPIV2ObjectsPostPost /v2/objectsCreate an object
RecordsAPIV2ObjectsObjectRecordsPostPost /v2/objects/{object}/recordsCreate a record
RecordsAPIV2ObjectsObjectRecordsPutPut /v2/objects/{object}/recordsAssert a record
RecordsAPIV2ObjectsObjectRecordsQueryPostPost /v2/objects/{object}/records/queryList records
RecordsAPIV2ObjectsObjectRecordsRecordIdAttributesAttributeValuesGetGet /v2/objects/{object}/records/{record_id}/attributes/{attribute}/valuesList record attribute values
RecordsAPIV2ObjectsObjectRecordsRecordIdDeleteDelete /v2/objects/{object}/records/{record_id}Delete a record
RecordsAPIV2ObjectsObjectRecordsRecordIdEntriesGetGet /v2/objects/{object}/records/{record_id}/entriesList record entries
RecordsAPIV2ObjectsObjectRecordsRecordIdGetGet /v2/objects/{object}/records/{record_id}Get a record
RecordsAPIV2ObjectsObjectRecordsRecordIdPatchPatch /v2/objects/{object}/records/{record_id}Update a record
TasksAPIV2TasksGetGet /v2/tasksList tasks
TasksAPIV2TasksPostPost /v2/tasksCreate a task
TasksAPIV2TasksTaskIdDeleteDelete /v2/tasks/{task_id}Delete a task
TasksAPIV2TasksTaskIdGetGet /v2/tasks/{task_id}Get a task
TasksAPIV2TasksTaskIdPatchPatch /v2/tasks/{task_id}Update a task
ThreadsAPIV2ThreadsGetGet /v2/threadsList threads
ThreadsAPIV2ThreadsThreadIdGetGet /v2/threads/{thread_id}Get a thread
WebhooksAPIV2WebhooksGetGet /v2/webhooksList webhooks
WebhooksAPIV2WebhooksPostPost /v2/webhooksCreate a webhook
WebhooksAPIV2WebhooksWebhookIdDeleteDelete /v2/webhooks/{webhook_id}Delete a webhook
WebhooksAPIV2WebhooksWebhookIdGetGet /v2/webhooks/{webhook_id}Get a webhook
WebhooksAPIV2WebhooksWebhookIdPatchPatch /v2/webhooks/{webhook_id}Update a webhook
WorkspaceMembersAPIV2WorkspaceMembersGetGet /v2/workspace_membersList workspace members
WorkspaceMembersAPIV2WorkspaceMembersWorkspaceMemberIdGetGet /v2/workspace_members/{workspace_member_id}Get a workspace member

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

oauth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://app.attio.com/authorize
  • Scopes:
  • user_management:read: View workspace members.
  • user_management:read-write: View workspace members.
  • record_permission:read: View, and optionally write, records.
  • record_permission:read-write: View, and optionally write, records.
  • object_configuration:read: View, and optionally write, the configuration and attributes of objects.
  • object_configuration:read-write: View, and optionally write, the configuration and attributes of objects.
  • list_entry:read: View, and optionally write, the entries in a list.
  • list_entry:read-write: View, and optionally write, the entries in a list.
  • list_configuration:read: View, and optionally write, the configuration and attributes of lists.
  • list_configuration:read-write: View, and optionally write, the configuration and attributes of lists.
  • public_collection:read: View, and optionally write, both the settings and information within public collections.
  • public_collection:read-write: View, and optionally write, both the settings and information within public collections.
  • private_collection:read: View, and optionally modify, both the settings and information of all collections within the workspace, regardless of their access settings.
  • private_collection:read-write: View, and optionally modify, both the settings and information of all collections within the workspace, regardless of their access settings.
  • comment:read: View comments (and threads), and optionally write comments.
  • comment:read-write: View comments (and threads), and optionally write comments.
  • task:read: View, and optionally write, tasks.
  • task:read-write: View, and optionally write, tasks.
  • note:read: View, and optionally write, notes.
  • note:read-write: View, and optionally write, notes.
  • webhook:read: View, and optionally manage, webhooks.
  • webhook:read-write: View, and optionally manage, webhooks.

Example

auth := context.WithValue(context.Background(), openapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, openapi.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]