public static RequestApiResult <WeixinGetUserTagListResult> GetUserTagList(DomainContext domainContext, string openId)
        {
            string accessToken = domainContext.AccessToken;
            RequestApiResult <WeixinGetUserTagListResult> result = TagsApi.GetUserTagList(accessToken, openId);

            if (result.Success == false)
            {
                if (result.Retry)
                {
                    if (result.ApiError.ErrorCode == 40001)
                    {
                        accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken);
                    }

                    result = TagsApi.GetUserTagList(accessToken, openId);
                    if (result.Success == false)
                    {
                        _log.Write("TagsApi.GetUserTagList 失败",
                                   result.GetDetail(), TraceEventType.Warning);
                    }
                }
                else
                {
                    _log.Write("TagsApi.GetUserTagList 失败",
                               result.GetDetail(), TraceEventType.Warning);
                }
            }

            return(result);
        }
        public static RequestApiResult Update(DomainContext domainContext, WeixinTag args)
        {
            string           accessToken = domainContext.AccessToken;
            RequestApiResult result      = TagsApi.Update(accessToken, args);

            if (result.Success == false)
            {
                if (result.Retry)
                {
                    if (result.ApiError.ErrorCode == 40001)
                    {
                        accessToken = AccessTokenGetter.Refresh(domainContext.AppId, accessToken);
                    }

                    result = TagsApi.Update(accessToken, args);
                    if (result.Success == false)
                    {
                        _log.Write("TagsApi.Update 失败",
                                   result.GetDetail(), TraceEventType.Warning);
                    }
                }
                else
                {
                    _log.Write("TagsApi.Update 失败",
                               result.GetDetail(), TraceEventType.Warning);
                }
            }

            return(result);
        }
示例#3
0
        public TogglApi(ApiConfiguration configuration, IApiClient apiClient)
        {
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));

            var userAgent   = configuration.UserAgent;
            var credentials = configuration.Credentials;
            var serializer  = new JsonSerializer();
            var endpoints   = new Endpoints(configuration.Environment);

            Status             = new StatusApi(endpoints, apiClient);
            Tags               = new TagsApi(endpoints, apiClient, serializer, credentials);
            User               = new UserApi(endpoints, apiClient, serializer, credentials);
            Tasks              = new TasksApi(endpoints, apiClient, serializer, credentials);
            Clients            = new ClientsApi(endpoints, apiClient, serializer, credentials);
            Projects           = new ProjectsApi(endpoints, apiClient, serializer, credentials);
            Location           = new LocationApi(endpoints, apiClient, serializer, credentials);
            Countries          = new CountriesApi(endpoints, apiClient, serializer, credentials);
            Workspaces         = new WorkspacesApi(endpoints, apiClient, serializer, credentials);
            Preferences        = new PreferencesApi(endpoints, apiClient, serializer, credentials);
            ProjectsSummary    = new ProjectsSummaryApi(endpoints, apiClient, serializer, credentials);
            TimeEntries        = new TimeEntriesApi(endpoints, apiClient, serializer, credentials, userAgent);
            TimeEntriesReports = new TimeEntriesReportsApi(endpoints, apiClient, serializer, credentials);
            WorkspaceFeatures  = new WorkspaceFeaturesApi(endpoints, apiClient, serializer, credentials);
            Feedback           = new FeedbackApiClient(endpoints, apiClient, serializer, credentials);
            Timezones          = new TimezonesApi(endpoints, apiClient, serializer, credentials);
        }
示例#4
0
        public TogglApi(ApiConfiguration configuration, HttpClientHandler handler = null)
        {
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));

            var httpHandler = handler ?? new HttpClientHandler {
                AutomaticDecompression = GZip | Deflate
            };
            var httpClient = new HttpClient(httpHandler);

            var userAgent   = configuration.UserAgent;
            var credentials = configuration.Credentials;
            var serializer  = new JsonSerializer();
            var apiClient   = new ApiClient(httpClient, userAgent);
            var endpoints   = new Endpoints(configuration.Environment);

            Status            = new StatusApi(endpoints, apiClient);
            Tags              = new TagsApi(endpoints, apiClient, serializer, credentials);
            User              = new UserApi(endpoints, apiClient, serializer, credentials);
            Tasks             = new TasksApi(endpoints, apiClient, serializer, credentials);
            Clients           = new ClientsApi(endpoints, apiClient, serializer, credentials);
            Projects          = new ProjectsApi(endpoints, apiClient, serializer, credentials);
            Location          = new LocationApi(endpoints, apiClient, serializer, credentials);
            Countries         = new CountriesApi(endpoints, apiClient, serializer, credentials);
            Workspaces        = new WorkspacesApi(endpoints, apiClient, serializer, credentials);
            Preferences       = new PreferencesApi(endpoints, apiClient, serializer, credentials);
            ProjectsSummary   = new ProjectsSummaryApi(endpoints, apiClient, serializer, credentials);
            TimeEntries       = new TimeEntriesApi(endpoints, apiClient, serializer, credentials, userAgent);
            WorkspaceFeatures = new WorkspaceFeaturesApi(endpoints, apiClient, serializer, credentials);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ParasutClient"/> class.
        /// </summary>
        /// <param name="url">The url<see cref="string"/>.</param>
        /// <param name="version">The version<see cref="string"/>.</param>
        /// <param name="companyId">The companyId<see cref="string"/>.</param>
        /// <param name="clientId">The clientId<see cref="string"/>.</param>
        /// <param name="clientSecret">The clientSecret<see cref="string"/>.</param>
        /// <param name="username">The username<see cref="string"/>.</param>
        /// <param name="password">The password<see cref="string"/>.</param>
        public ParasutClient(string url          = null,
                             string version      = null,
                             string companyId    = null,
                             string clientId     = null,
                             string clientSecret = null,
                             string username     = null,
                             string password     = null) : base()
        {
            Url          = ParasutApiSettings.Url(url);
            Version      = ParasutApiSettings.Version(version);
            CompanyId    = ParasutApiSettings.CompanyId(companyId);
            ClientId     = ParasutApiSettings.ClientId(clientId);
            ClientSecret = ParasutApiSettings.ClientSecret(clientSecret);
            Username     = ParasutApiSettings.Username(username);
            Password     = ParasutApiSettings.Password(password);

            GenerateConfiguration();



            Home            = new ApiHomeApi(Configuration);
            ItemCategories  = new ItemCategoriesApi(Configuration);
            Accounts        = new AccountsApi(Configuration);
            BankFees        = new BankFeesApi(Configuration);
            Contacts        = new ContactsApi(Configuration);
            EArchives       = new EArchivesApi(Configuration);
            EInvoiceInboxes = new EInvoiceInboxesApi(Configuration);
            EInvoices       = new EInvoicesApi(Configuration);
            Employees       = new EmployeesApi(Configuration);
            Products        = new ProductsApi(Configuration);
            PurchaseBills   = new PurchaseBillsApi(Configuration);
            Salaries        = new SalariesApi(Configuration);
            SalesInvoices   = new SalesInvoicesApi(Configuration);
            Tags            = new TagsApi(Configuration);
            Taxes           = new TaxesApi(Configuration);
            TrackableJobs   = new TrackableJobsApi(Configuration);
            Transactions    = new TransactionsApi(Configuration);
        }
示例#6
0
        public TogglApi(ApiConfiguration configuration, HttpClientHandler handler = null)
        {
            Ensure.Argument.IsNotNull(configuration, nameof(configuration));

            var httpHandler = handler ?? new NativeMessageHandler {
                AutomaticDecompression = GZip | Deflate
            };
            var httpClient = new HttpClient(httpHandler);

            var credentials = configuration.Credentials;
            var serializer  = new JsonSerializer();
            var apiClient   = new ApiClient(httpClient, configuration.UserAgent);
            var endpoints   = new Endpoints(configuration.Environment);

            Tags        = new TagsApi(endpoints.Tags, apiClient, serializer, credentials);
            User        = new UserApi(endpoints.User, apiClient, serializer, credentials);
            Tasks       = new TasksApi();
            Status      = new StatusApi(endpoints.Status, apiClient);
            Clients     = new ClientsApi(endpoints.Clients, apiClient, serializer, credentials);
            Projects    = new ProjectsApi(endpoints.Projects, apiClient, serializer, credentials);
            Workspaces  = new WorkspacesApi(endpoints.Workspaces, apiClient, serializer, credentials);
            TimeEntries = new TimeEntriesApi(endpoints.TimeEntries, apiClient, serializer, credentials);
        }
示例#7
0
 public void Init()
 {
     instance = new TagsApi();
 }
 public TagsApiTests()
 {
     instance = new TagsApi();
 }