Skip to content
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

ModelDerivativeAPI - add support for x-ads-headers and advanced translation options #15

Open
wants to merge 77 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
298ee9c
Add support for x-ads-... headers
woweh Jun 29, 2022
52331b0
Add GetMetadata function
woweh Jun 29, 2022
ef95f42
Change module to "github.com/woweh/forge-api-go-client" for testing
woweh Jun 29, 2022
f026416
Update go.mod to target tag v0.2.6
woweh Jun 30, 2022
1987361
Add Advanced translation options for and move x-ads-headers into a se…
woweh Jul 1, 2022
6b18ed9
Fix and tweaks advanced options and xAdsHeaders
woweh Jul 4, 2022
757a4f8
Update go.mod to use go 1.18 and target v0.2.8
woweh Jul 4, 2022
554ecc8
Add target specific funcs for advanced translation options, add and u…
woweh Jul 5, 2022
e181f8c
Move enums into one file
woweh Jul 6, 2022
7c7e4c4
Move xAdsHeaders, make optional primitives pointers, add and update c…
woweh Jul 6, 2022
9a1e757
Add tests for AdvancedSpec
woweh Jul 6, 2022
50cefb7
Bump version to v0.2.10
woweh Jul 6, 2022
db828ba
Change XxxAdvancedSpec to returns points and bump version to v0.2.11
woweh Jul 6, 2022
17e0cd7
Extend Manifest Types and set version to v0.2.12
woweh Jul 6, 2022
88fe8e7
Make ObjectIDs []int and set version to v0.2.13
woweh Jul 6, 2022
2347b78
Add support for x-ads-headers and advanced translation options
woweh Jul 7, 2022
59552bd
Set version to v0.2.15
woweh Jul 7, 2022
8ca5098
disable messages in Manifests for the time being, because of inconsis…
woweh Jul 19, 2022
ed79f75
Set version to v0.2.16
woweh Jul 19, 2022
39de224
Fix version issue, set v0.2.17
woweh Jul 19, 2022
ec74ece
WIP - just about started
woweh Sep 1, 2022
9f8587d
Get number of download/upload parts
woweh Sep 1, 2022
9cfda69
WIP
woweh Sep 8, 2022
5081ba7
Upload is ready for testing
woweh Sep 9, 2022
b575f1d
Fix - return the concrete error
woweh Sep 9, 2022
86aa74b
Update unit tests - wip
woweh Sep 9, 2022
f826753
Fixes and tweaks - happy path is working
woweh Sep 12, 2022
4936712
Rename and reformat package
woweh Sep 12, 2022
7e7b8d6
Update readme
woweh Sep 12, 2022
2193530
Fix typo
woweh Sep 13, 2022
9c6cf50
Add retrying, move upload into separate file, add comments
woweh Sep 13, 2022
0e92faf
Use even simpler retry mechanism, plus fixes and refacortings
woweh Sep 14, 2022
fc6f672
Merge branch 'Direct-to-S3'
woweh Sep 14, 2022
def24de
Update README.md
woweh Sep 14, 2022
047a099
Update download, update and refactor unit test, start updating list b…
woweh Sep 14, 2022
2b92ffa
Add some logging to the object upload process
woweh Sep 15, 2022
454487a
Update ReadMe
woweh Sep 15, 2022
0b48ff3
Merge branch 'Direct-to-s3-download'
woweh Sep 15, 2022
8290d3d
Update ReadMe
woweh Sep 15, 2022
bb010be
Update readme
woweh Jun 13, 2023
ff91397
Ignore .vscode directory
woweh Jun 14, 2023
2e7bec4
Update to use V2 Authentication
woweh Jun 14, 2023
5f5ada3
Fix Model Derivative tests and manifest issues
woweh Jun 14, 2023
49a038a
Update to go 1.20
woweh Jun 14, 2023
bcb1621
Update ReadMe and doc
woweh Jun 15, 2023
839c936
Merge branch 'OAuthV2_Update'
woweh Jun 15, 2023
96e2f97
Update docs
woweh Jun 15, 2023
c871c67
WIP - almost done
woweh Jun 15, 2023
d1458df
WIP - Continued...
woweh Jun 15, 2023
1eb161e
WIP - Continued...
woweh Jun 16, 2023
b8e4274
WIP - Continued...
woweh Jun 16, 2023
7a02b1e
WIP - fixes, refactorings, updated tests...
woweh Jun 18, 2023
0636ba1
WIP - md looks fine, reviewing the dm tests
woweh Jun 19, 2023
5757fa0
Fix dm tests
woweh Jun 19, 2023
016f3fb
Merge branch 'AddEmeaSupport'
woweh Jun 19, 2023
4abea8b
Fix log message
woweh Jun 19, 2023
28857c1
Update readme and doc
woweh Jun 20, 2023
ab1d00b
More readme and doc updates
woweh Jun 20, 2023
1d3753a
Change ...TranslationParams to accept urn instead of objectId
woweh Jun 20, 2023
09c4cef
Fix unit tests
woweh Jun 20, 2023
49e7a95
Make Derivative.Status type Status
woweh Jun 20, 2023
b6d3036
Fix s3upload bug > v0.2.25
woweh Jun 21, 2023
9a8b092
Refactored manifest and test, add extra helper functions to the API
woweh Jun 21, 2023
d62871b
format project and fix some spelling
woweh Jun 27, 2023
10d9519
Tweak Manifest, use Region type
woweh Jun 28, 2023
304e3f2
Add case insensitive region checks
woweh Jul 6, 2023
84b6d7d
Fix (m *Manifest) GetProgressReportOfChild
woweh Jul 6, 2023
9467699
Add case insensitive status checks
woweh Jul 6, 2023
f610063
Add check if the ProgressReport is empty
woweh Jul 6, 2023
b3b0cd5
Fix GetMetadata (no XAdsHeaders required) and update comments
woweh Jul 6, 2023
a1d2251
Add and update unit test
woweh Jul 6, 2023
5c54620
MD & DA Api, add getter and setter for Region, plus...
woweh Jul 28, 2023
eb88b96
Stream data when downloading a derivative
woweh Aug 1, 2023
241f036
Rename shadowed vars
woweh Aug 8, 2023
d42cabf
Tweak more region issues and add tests
woweh Aug 8, 2023
a0ffbd3
PhaseNames in manifests can either be a string, or an array of strings
woweh Aug 28, 2023
2ee53ae
Remove verbose logging
woweh Sep 21, 2023
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ crashlytics.properties
crashlytics-build.properties
fabric.properties
.idea/

.vscode/
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2017 Denis Grigor
Portions Copyright (c) 2022-2023 Wolfgang Weh

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
91 changes: 82 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,90 @@
[![Build Status](https://travis-ci.org/apprentice3d/forge-api-go-client.svg?branch=master)](https://travis-ci.org/apprentice3d/forge-api-go-client)
[![GoDoc](https://godoc.org/github.com/apprentice3d/forge-api-go-client?status.svg)](https://godoc.org/github.com/apprentice3d/forge-api-go-client)
[![Go Report Card](https://goreportcard.com/badge/github.com/apprentice3d/forge-api-go-client)](https://goreportcard.com/report/github.com/apprentice3d/forge-api-go-client)
[![GoDoc](https://godoc.org/github.com/woweh/forge-api-go-client?status.svg)](https://godoc.org/github.com/woweh/forge-api-go-client)
[![Go Report Card](https://goreportcard.com/badge/github.com/woweh/forge-api-go-client)](https://goreportcard.com/report/github.com/woweh/forge-api-go-client)

# forge-api-go-client


**Forge API:** [![oAuth2](https://img.shields.io/badge/oAuth2-v2-green.svg)](http://developer-autodesk.github.io/)
[![Data-Management](https://img.shields.io/badge/Data%20Management-v1-green.svg)](http://autodesk-forge.github.io/)
[![OSS](https://img.shields.io/badge/OSS-v2-green.svg)](http://autodesk-forge.github.io/)
[![Model-Derivative](https://img.shields.io/badge/Model%20Derivative-v2-green.svg)](http://autodesk-forge.github.io/)
[![Reality-Capture](https://img.shields.io/badge/Reality%20Capture-v1-green.svg)](http://developer-autodesk.github.io/)
**Autodesk Platform Services APIs:**
[![Authentication](https://img.shields.io/badge/Authentication-v2-green.svg)](https://aps.autodesk.com/en/docs/oauth/v2/developers_guide/overview/)
[![Data-Management](https://img.shields.io/badge/Data%20Management-v2-green.svg)](https://aps.autodesk.com/en/docs/data/v2/developers_guide/)
[![Model-Derivative](https://img.shields.io/badge/Model%20Derivative-v2-green.svg)](https://aps.autodesk.com/en/docs/model-derivative/v2/developers_guide/)


Golang SDK for building Forge based applications
Golang API client for building APS based applications ([Autodesk Platform Services], formerly *"Forge"*).

This is a fork of the [forge-api-go-client by Denis Grigor](https://github.com/apprentice3d/forge-api-go-client).
The original client is no longer maintained.
This forks has been updated and extended with new features.

---
## Supported and maintained APIs
Note that this client only covers a subset of the APS APIs.

At the time of writing (2023/06/15), only the following APIs are maintained:
1. Authentication (oauth)
2. Data Management (dm)
3. Model Derivative (md)

The following APIs are not maintained:
1. Reality Capture (rc)
2. Design Automation (da)

Autodesk is constantly adding new APIs and changing existing APIs.
A lot of the new APIs are not covered by this client.

You are invited to contribute 🧑🏽‍💻!
Please fork and add missing APIs.

---
## Updates from the original client

The client has been extended with the following features.
Note that there are a number of breaking changes.

### Authentication (oauth):
- Update to OAuth V2.
See: https://aps.autodesk.com/blog/migration-guide-oauth2-v1-v2


### Data Management API (dm):
- Update `upload object` and `download object` to use the direct-to-s3 approach (breaking change).
See:
- https://forge.autodesk.com/blog/data-management-oss-object-storage-service-migrating-direct-s3-approach
- https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3upload-GET/
- https://forge.autodesk.com/en/docs/data/v2/reference/http/buckets-:bucketKey-objects-:objectKey-signeds3download-GET/
- Add support for regions (US <> EMEA):
See: https://aps.autodesk.com/blog/data-management-and-model-derivative-regions
- dm Initialization now requires a region (breaking change).
- BucketAPI is renamed to OssAPI (breaking change).
- The API is changed to use pointer receivers.
- Update ListBuckets to list all buckets.
See: https://aps.autodesk.com/en/docs/data/v2/reference/http/buckets-GET/
- Fix and update unit tests. You need a valid APS account (client ID and secret) to run the tests.
=> Best run the tests locally, or on a private CI server.


### Model Derivative API (md):
- Add support for x-ads-headers and advanced translation options (input > formats > advanced).
See: https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/jobs/job-POST/
- Update GET derivatives to use the `signedcookies` endpoint.
See:
- https://aps.autodesk.com/blog/data-management-oss-object-storage-service-migrating-direct-s3-approach
- https://aps.autodesk.com/en/docs/model-derivative/v2/reference/http/urn-manifest-derivativeUrn-signedcookies-GET/
- Add support for regions (US <> EMEA):
See: https://aps.autodesk.com/blog/data-management-and-model-derivative-regions
- md Initialization now requires a region (breaking change).
- Add support for downloading all properties.
See: https://aps.autodesk.com/en/docs/model-derivative/v2/reference/http/metadata/urn-metadata-guid-properties-GET/
- Add support for fetching the object tree.
See: https://aps.autodesk.com/en/docs/model-derivative/v2/reference/http/metadata/urn-metadata-guid-GET/
- The API is changed to use pointer receivers.
- Fix and update unit tests. You need a valid APS account (client ID and secret) to run the tests.
=> Best run the tests locally, or on a private CI server.

---
## TODO:
- Create proper changelog.
- Add support for more APIs.

---
[Autodesk Platform Services]: https://aps.autodesk.com/
35 changes: 35 additions & 0 deletions api_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package forge

// This file contains types and constants for the entire APS (aka Forge) API.

import "strings"

// HostName / domain of the Autodesk Forge API.
const HostName = "https://developer.api.autodesk.com"

// Region is the region where the data resides.
type Region string

const (
US Region = "us" // US Region - us in lowercase!
EU Region = "emea" // EU (== EMEA) Region - emea in lowercase!
EMEA Region = "emea" // EMEA (== EU) Region - emea in lowercase!
)

// IsUS returns true if the region is US.
func (r Region) IsUS() bool {
// case insensitive comparison!
return strings.EqualFold(string(r), string(US))
}

// IsEMEA returns true if the region is EMEA (== EU).
func (r Region) IsEMEA() bool {
// case insensitive comparison!
return strings.EqualFold(string(r), string(EMEA))
}

// IsEU returns true if the region is EU (== EMEA).
func (r Region) IsEU() bool {
// case insensitive comparison!
return strings.EqualFold(string(r), string(EU))
}
Loading