(Accounting.Attachments)
- List - List Attachments
- Get - Get Attachment
- Delete - Delete Attachment
- Download - Download Attachment
List Attachments
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.Attachments.List(ctx, operations.AccountingAttachmentsAllRequest{
ReferenceType: components.AttachmentReferenceTypeInvoice,
ReferenceID: "123456",
ServiceID: sdkgo.String("salesforce"),
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetAttachmentsResponse != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingAttachmentsAllRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingAttachmentsAllResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get Attachment
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.Attachments.Get(ctx, operations.AccountingAttachmentsOneRequest{
ReferenceType: components.AttachmentReferenceTypeInvoice,
ReferenceID: "123456",
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetAttachmentResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingAttachmentsOneRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingAttachmentsOneResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Delete Attachment
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.Attachments.Delete(ctx, operations.AccountingAttachmentsDeleteRequest{
ReferenceType: components.AttachmentReferenceTypeInvoice,
ReferenceID: "123456",
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
})
if err != nil {
log.Fatal(err)
}
if res.DeleteAttachmentResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingAttachmentsDeleteRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingAttachmentsDeleteResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Download Attachment
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.Attachments.Download(ctx, operations.AccountingAttachmentsDownloadRequest{
ReferenceType: components.AttachmentReferenceTypeInvoice,
ReferenceID: "123456",
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetAttachmentDownloadResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingAttachmentsDownloadRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingAttachmentsDownloadResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |