Documentation
¶
Overview ¶
Package implements access to Upwork API
Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author:: Maksym Novozhylov (mnovozhilov@upwork.com) Copyright:: Copyright 2018(c) Upwork.com License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
Package implements access to Upwork API ¶
Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Author:: Maksym Novozhylov (mnovozhilov@upwork.com) Copyright:: Copyright 2018(c) Upwork.com License:: See LICENSE.txt and TOS - https://developers.upwork.com/api-tos.html
Index ¶
- Constants
- type ApiClient
- func (c *ApiClient) Delete(uri string, params map[string]string) (r *http.Response, re interface{})
- func (c *ApiClient) Get(uri string, params map[string]string) (r *http.Response, re interface{})
- func (c *ApiClient) GetAuthorizationUrl(stateString string) (authzUrl string)
- func (c *ApiClient) GetToken(ctx context.Context, authzCode string) *oauth2.Token
- func (c *ApiClient) HasAccessToken(ctx context.Context) bool
- func (c *ApiClient) Post(uri string, params map[string]string) (r *http.Response, re interface{})
- func (c *ApiClient) Put(uri string, params map[string]string) (r *http.Response, re interface{})
- func (c *ApiClient) SetApiResponseType(t string)
- func (c *ApiClient) SetEntryPoint(ep string)
- func (c *ApiClient) SetOrgUidHeader(ctx context.Context, tenantId string)
- func (c *ApiClient) SetPostAsJson(t bool)
- func (c *ApiClient) SetRefreshTokenNotifyFunc(f TokenNotifyFunc)
- type Config
- type HeadersTransport
- type NotifyingTokenSource
- type TokenNotifyFunc
Constants ¶
const ( // oauth2 and api flow BaseHost = "https://www.upwork.com/" DefaultEpoint = "api" GqlEndpoint = "https://api.upwork.com/graphql" AuthorizationEP = BaseHost + "ab/account-security/oauth2/authorize" AccessTokenEP = BaseHost + DefaultEpoint + "/v3/oauth2/token" DataFormat = "json" OverloadParam = "http_method" UPWORK_LIBRARY_USER_AGENT = "Github Upwork API Golang Library" // response types ByteResponse = "[]byte" ErrorResponse = "error" )
Define end points
const (
TIMEFORMAT = "2006-01-02T15:04:05.000Z" // NOTE: time.RFC3339 does not work for unclear reason?
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiClient ¶
type ApiClient struct {
// contains filtered or unexported fields
}
Api client
func (*ApiClient) GetAuthorizationUrl ¶
Receive an authorization URL
func (*ApiClient) HasAccessToken ¶
Check if client contains already a access/refresh token pair
func (*ApiClient) SetApiResponseType ¶
Set API response type
func (*ApiClient) SetEntryPoint ¶
Set entry point, e.g requested from a router
func (*ApiClient) SetOrgUidHeader ¶
setup X-Upwork-API-TenantId header
func (*ApiClient) SetPostAsJson ¶
Set request type for non-Get requests
func (*ApiClient) SetRefreshTokenNotifyFunc ¶
func (c *ApiClient) SetRefreshTokenNotifyFunc(f TokenNotifyFunc)
Set refresh token notify function
type Config ¶
type Config struct { ClientId string ClientSecret string AccessToken string RefreshToken string RedirectUri string ExpiresIn string ExpiresAt time.Time State string Debug bool HasCustomHttpClient bool TenantIdHeader string // X-Upwork-API-TenantId required for GraphQL requests }
Config
func ReadConfig ¶
Read a specific configuration (json) file
func (*Config) SetCustomHttpClient ¶
func (cfg *Config) SetCustomHttpClient(ctx context.Context, httpClient *http.Client) context.Context
Configure a context with the custom http client
func (*Config) SetOrgUidHeader ¶
Configure X-Upwork-API-TenantId header for OwnHttpClient
type HeadersTransport ¶
type HeadersTransport struct {
// contains filtered or unexported fields
}
type NotifyingTokenSource ¶
type NotifyingTokenSource struct {
// contains filtered or unexported fields
}
NotifyingTokenSource is an oauth2.TokenSource that calls a function when a new token is obtained.
func NewNotifyingTokenSource ¶
func NewNotifyingTokenSource(src oauth2.TokenSource, f TokenNotifyFunc) *NotifyingTokenSource
NewNotifyingTokenSource creates a NotifyingTokenSource from an underlying src and calls f when a new token is obtained.
type TokenNotifyFunc ¶
TokenNotifyFunc is a function that accepts an oauth2 Token upon refresh, and returns an error if it should not be used.
Directories
¶
Path | Synopsis |
---|---|
routers
|
|
activities/engagement
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
activities/team
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
auth
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
freelancers/profile
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
freelancers/search
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
graphql
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/clients/applications
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/clients/offers
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/contracts
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/engagements
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/freelancers/applications
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/freelancers/offers
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/interviews
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/jobs
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/milestones
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/roles
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
hr/submissions
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
jobs/profile
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
jobs/search
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
messages
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
metadata
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
organization/companies
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
organization/teams
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
organization/users
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
payments
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
reports/finance/accounts
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
reports/finance/billings
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
reports/finance/earnings
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
reports/time
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
snapshot
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
workdays
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |
workdiary
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms.
|
Router for Upwork API Licensed under the Upwork's API Terms of Use; you may not use this file except in compliance with the Terms. |